BartC <b...@freeuk.com>:

> Of course this doesn't help you parsing typical input which uses
> commas as separators, not terminators!

That's a red herring. You mustn't parse with eval(). You shouldn't event
think of parsing non-Python data with eval(). Why should Python's syntax
resemble a CSV file?

Try compiling the data file with a C compiler or bash.

The real answer is to do:

    "a,b,c".split(",")
    ==> ['a', 'b', 'c']

Now, tuples would be trivial:

    tuple("a,b,c".split(","))
    ==> ('a', 'b', 'c')

but a tuple is probably not what you'd want here since the number of
data elements in the OP's question is not constant.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to