"Bryan Fodness" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
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.

line = '[2.5,2.8]'
x1,x2 = eval(line)
x1,x2
(2.5, 2.7999999999999998)

-Mark

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to