Manipulating MySQL Sets
Victor Subervi
victorsubervi at gmail.com
Sun Dec 13 12:20:58 EST 2009
On Sun, Dec 13, 2009 at 11:26 AM, Sebastian Bassi
<sbassi at clubdelarazon.org>wrote:
> On Sun, Dec 13, 2009 at 12:48 PM, Victor Subervi
> <victorsubervi at gmail.com> wrote:
> > Who said I was expecting a string? I don't know what I'm expecting! I
> need
> > to be able to parse this thing, whatever it is. You say it's a Python Set
> > object. How do I parse it? Googling has been disappointing.
>
> You can walk thought a set object like any iterable object like
>
> for x in myset:
> #do something like parse it.
>
> If you want to slice it, convert it to a list:
>
> mylist = list(myset)
>
> Or read about sets:
> http://docs.python.org/library/sets.html
>
Both the following solutions threw the same error:
newCol = list(colValue[0])
print newCol[0:20]
and
for x in colValue[0]:
print x
/var/www/html/angrynates.com/cart/display.py
98 raise
99 cursor.close()
100 bottom()
101
102 display()
display = <function display>
/var/www/html/angrynates.com/cart/display.py in display()
50 # newCol = list(colValue[0])
51 # print newCol[0:20]
52 for x in colValue[0]:
53 print x
54 print 'XXX'
x undefined, colValue = (datetime.date(2009, 10, 22),)
TypeError: iteration over non-sequence
args = ('iteration over non-sequence',)
V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091213/3e11f25d/attachment-0001.html>
More information about the Python-list
mailing list