determining the bounds of a tuple returned from a database
fredrik at pythonware.com
Fri Nov 17 09:33:37 CET 2006
> very sorry, that was my error - len(result) and len(result) both
> return 1 --
> i think I'm misunderstanding what len() does - to me they appear to
> have 2 or 3 elements, or at least be composed of a string of some
from python's perspective, the data structure you're looking at looks
so len(result) is the number of tuples, and len(result[index]) is the
number of strings in the inner tuples (=1). to get at an individual
s = result[index]
to look inside the string, you need to apply the appropriate string
operations to extract the data, or split it up in some suitable way.
there's no way Python can figure out how a string appears to you; from
Python's perspective, it's just a bunch of characters.
More information about the Python-list