Hi,
I want to print some records from a database table where one of the
fields contains a JSON string which is read into a dict. I am doing
something like
print(f"{id} {d['foo']} {d['bar']}")
However, the dict does not always have the same keys, so d['foo'] or
d['bar'] may be undefined. I ca
On 24/11/2023 14:31, Loris Bennett wrote:
Hi,
I want to print some records from a database table where one of the
fields contains a JSON string which is read into a dict. I am doing
something like
print(f"{id} {d['foo']} {d['bar']}")
However, the dict does not always have the same keys, so
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
On 24/11/2023 16:35, duncan smith wrote:
On 24/11/2023 14:31, Loris Bennett wrote:
Hi,
I want to print some records from a database table where one of the
fields contains a JSON string which is read into a dict. I am doing
something like
print(f"{id} {d['foo']} {d['bar']}")
However, the d
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()
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'
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
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
On 11/25/2023 3:31 AM, Loris Bennett via Python-list wrote:
Hi,
I want to print some records from a database table where one of the
fields contains a JSON string which is read into a dict. I am doing
something like
print(f"{id} {d['foo']} {d['bar']}")
However, the dict does not always have
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.
10 matches
Mail list logo