P
planetthoughtful
Hi All,
Sorry for the influx of newbie questions -- I'm trying to figure these
things out on my own before bothering the community, but a lot of bits
and pieces are escaping me at the moment.
I'm retrieving a result set from an SQLite db (using the APSW module)
and I want to add the value from one of the fields in the result set to
a list. My current code looks something like:
result = []
for name in cursor.execute("SELECT name, address FROM contacts ORDER BY
name"):
result.extend(name)
print result
For reasons I (obviously) don't understand, the "name" values get
broken up into each individual letter of the values in the name field
in the result list.
So, if the table contained records:
Fred
Dave
When I "print result" I get:
['F','r','e','d','D','a','v','e']
What I'm looking for is:
['Fred','Dave']
Can anyone give me some advice on what I'm doing wrong?
Many thanks and much warmth,
planetthoughtful
Sorry for the influx of newbie questions -- I'm trying to figure these
things out on my own before bothering the community, but a lot of bits
and pieces are escaping me at the moment.
I'm retrieving a result set from an SQLite db (using the APSW module)
and I want to add the value from one of the fields in the result set to
a list. My current code looks something like:
result = []
for name in cursor.execute("SELECT name, address FROM contacts ORDER BY
name"):
result.extend(name)
print result
For reasons I (obviously) don't understand, the "name" values get
broken up into each individual letter of the values in the name field
in the result list.
So, if the table contained records:
Fred
Dave
When I "print result" I get:
['F','r','e','d','D','a','v','e']
What I'm looking for is:
['Fred','Dave']
Can anyone give me some advice on what I'm doing wrong?
Many thanks and much warmth,
planetthoughtful