On 14/10/10 19:29, David Hutto wrote:
On Thu, Oct 14, 2010 at 2:19 PM, Sander Sweers<sander.swe...@gmail.com> wrote:
On 14 October 2010 16:14, David Hutto<smokefl...@gmail.com> wrote:
(u'graph1', u'Line', u'222', u'BLUE', u'1,2,3,4', u'True', u'0,5,0,10')
Which is a tuple of unicode strings. From this I
need to place portions of the tuple into other fields,
but not as unicode strings, but literals no ''.
For example if I have the following line:
self.lines = self.newplot.plot([1,2,3,4])
So you want convert string u'1,2,3,4' to a list of ints [1,2,3,4]?
Then the below will work.
[int(n) for n in u'1,2,3,4'.replace(',', '')]
Actually, I needed it to be converted to something without a string
attached to it. See a post above, and it was fixed by eval(),
Thanks though. And I'm sure at some point this morning in a moment of
frustration rather than logic, I tried your approach.
What do you mean by "without a string attached to it"?
Also using eval could be dangerous unless you're sure the stuff coming
out of your dbase is safe.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor