[Tutor] accessing list from a string

Bryan Fodness bryan.fodness at gmail.com
Tue Nov 25 15:41:22 CET 2008


I have a list in a text file that is in the python format.,

    Positions = [2.5,2.8]

and would like to grab the values.

    for line in file('list.txt'):
        if line == Positions:
            x1,x2=Positions

I know this does not work.  Is there a direct way to get my x1 and x2
values.

Thanks,
Bryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081125/1fddef3d/attachment.htm>


More information about the Tutor mailing list