>
> As you've written it, the statement declares your intent to enter both
> ‘conn’ and ‘conn.cursor()’ as context managers.
>
> https://docs.python.org/3/reference/compound_stmts.html#with>
>
> To “enter a context manager” entails calling the ‘__enter__’ method on
> the context manager obje
On Monday, 16 May 2016 12:45:26 UTC+10, DFS wrote:
> On 5/15/2016 10:21 PM, Sayth Renshaw wrote:
> > Hi
> >
> > I have a file and want to create the sqlite3 db. Using with however i
> > receive an attribute error and it causes an exit.
> >
> > The relevant section of the file is:
> >
> > import s
Sayth Renshaw writes:
> with conn, conn.cursor() as cur:
What are you expecting this ‘with’ statement to do?
As you've written it, the statement declares your intent to enter both
‘conn’ and ‘conn.cursor()’ as context managers.
https://docs.python.org/3/reference/compound_stmts.html#with>
Hi
I have a file and want to create the sqlite3 db. Using with however i receive
an attribute error and it causes an exit.
The relevant section of the file is:
import sqlite3
conn = sqlite3.connect("trial.db")
with conn, conn.cursor() as cur:
# First, create tables.
cur.execute("dr