Manipulating MySQL Sets
MRAB
python at mrabarnett.plus.com
Sun Dec 13 14:03:48 EST 2009
Victor Subervi wrote:
> On Sun, Dec 13, 2009 at 12:40 PM, Victor Subervi
> <victorsubervi at gmail.com <mailto:victorsubervi at gmail.com>> wrote:
>
> On Sun, Dec 13, 2009 at 12:39 PM, Victor Subervi
> <victorsubervi at gmail.com <mailto:victorsubervi at gmail.com>> wrote:
>
> PS: I have another field that's a datetime with the same problem.
> How do I parse and otherwise work with that?
>
>
> I have yet another problem with this. Once I've determined it's a Set or
> a datetime, I do this:
>
> for itm in colValue[0]:
> try:
> color, number = string.split(itm, ':')
> html += "<option name='%s'>%s</option>" % (itm, color)
> except:
> html += "<option name='%s'>%s</option>" % (itm, itm)
>
> The reason is I've entered my colors into my table as
> nameOfColor:colorNumber and I want to break them out for presentation
> purposes. However, the try never executes, only the except, and that
> shouldn't be. I can slice the itm. What gives?
>
1. Print repr(itm) so that you can check what it actually is. Is it
what you expected?
2. DON'T USE BARE EXCEPTS!
More information about the Python-list
mailing list