Re: Silly/crazy problem with sqlite

2023-11-26 Thread Chris Green via Python-list
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

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Thomas Passin via Python-list
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

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Mats Wichmann via Python-list
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

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Sibylle Koczian via Python-list
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

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Chris Green via Python-list
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

Silly/crazy problem with sqlite

2023-11-25 Thread Chris Green via Python-list
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()

Re: Silly/crazy problem with sqlite

2023-11-25 Thread 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 string. PyDev console: starting. Python 3.9.15 (main, Oct 28