Stefan Ram wrote:
> Chris Green writes:
> >I have to say this seems very non-pythonesque to me, the 'obvious'
> >default simply doesn't work right, and I really can't think of a case
> >where the missing comma would make any sense at all.
>
> |6.15 Expression lists
> ...
> |an expression list co
On 11/24/2023 4:49 PM, Rimu Atkinson via Python-list wrote:
I really can't think of a case
where the missing comma would make any sense at all.
That is pretty tricky, yes.
The comma means it's a tuple. Without the comma, it's just a string with
parenthesis around it, which is a string.
On 11/24/23 14:10, Chris Green via Python-list wrote:
Chris Green wrote:
This is driving me crazy, I'm running this code:-
OK, I've found what's wrong:-
cr.execute(sql, ('%' + "2023-11" + '%'))
should be:-
cr.execute(sql, ('%' + x + '%',) )
I have to say this seems very
Am 24.11.2023 um 22:49 schrieb Rimu Atkinson via Python-list:
I really can't think of a case
where the missing comma would make any sense at all.
That is pretty tricky, yes.
The comma means it's a tuple. Without the comma, it's just a string with
parenthesis around it, which is a strin
Chris Green wrote:
> This is driving me crazy, I'm running this code:-
OK, I've found what's wrong:-
> cr.execute(sql, ('%' + "2023-11" + '%'))
should be:-
cr.execute(sql, ('%' + x + '%',) )
I have to say this seems very non-pythonesque to me, the 'obvious'
default simply doesn'
This is driving me crazy, I'm running this code:-
#!/usr/bin/env python3
#
#
# Show the electric fence history, default to last 24 hours
#
import sqlite3
import datetime
import sys
today = datetime.datetime.now()
I really can't think of a case
where the missing comma would make any sense at all.
That is pretty tricky, yes.
The comma means it's a tuple. Without the comma, it's just a string with
parenthesis around it, which is a string.
PyDev console: starting.
Python 3.9.15 (main, Oct 28 2022
aiwarrior wrote:
> [...]
> What i'm going to study is whether it's possible to evaluate if a
> table already exists, and if so act accordingly. [...]
You can use a statement like "CREATE TABLE IF NOT EXISTS tbl(col1, col2);".
If you just want to check, you can query SQLite's schema metadata with
Ok regarding Gerhard's comment of the try, except, pass, i came to
understand that it's really bad code. And i should have referred that
i put that there be cause i was getting:
Traceback (most recent call last):
File "C:\Python25\Projects\cp.py", line 48, in
db = db()
File "C:\Python25\P
Ok regarding Gerhard's comment of the try, except, pass, i came to
understand that it's really bad code. And i should have referred that
i put that there be cause i was getting:
Traceback (most recent call last):
File "C:\Python25\Projects\cp.py", line 48, in
db = db()
File "C:\Python25\P
On Mar 29, 9:10 pm, Tim Roberts <[EMAIL PROTECTED]> wrote:
> aiwarrior <[EMAIL PROTECTED]> wrote:
> >def get_value( self, column ):
> >self.cursor.execute( "SELECT %s FROM database" % column )
> >for n in self.cursor:
> > print n
>
> I suspect you wanted "self.cursor
aiwarrior <[EMAIL PROTECTED]> wrote:
>
>I'm sorry about not saying showing the libraries. It was not on
>purpose.
You didn't make any comment on the rest of Gerhard's suggestion, nor does
it appear that you took any action to correct them.
You should get out of the habit of using extra parenthese
after executing insert
do conection.commit()
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 29, 6:41 pm, Gerhard Häring <[EMAIL PROTECTED]> wrote:
> Ok, I'll review your code.
>
> aiwarrior wrote:
> > class db:
> > def __init__(self): #constructor
> > conn = sqlite3.connect('./db.db')
> > conn.isolation_level = None
>
> Autocommit mode is mostly for newbies who
Ok, I'll review your code.
aiwarrior wrote:
> class db:
> def __init__(self): #constructor
> conn = sqlite3.connect('./db.db')
> conn.isolation_level = None
Autocommit mode is mostly for newbies who forget to call commit.
Unfortunately, newbiews find enough other ways to shoot
aiwarrior <[EMAIL PROTECTED]> wrote:
> When i execute this the database doesn't get filled with anything and
> the program stays running in memory for ever.
That's odd, when I execute the code you posted I just get "NameError:
global name 'sqlite3' is not defined". You should always try to post
class db:
def __init__(self): #constructor
conn = sqlite3.connect('./db.db')
conn.isolation_level = None
self.cursor = conn.cursor()
try:
self.cursor.execute("CREATE TABLE database
(album,filepath)" )
except:
pass
def add_entr
17 matches
Mail list logo