manstey wrote:
> That doesn't work. I just get an error:
>
> x = eval(line.strip('\n'))
> File "<string>", line 1
> [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})]
>
> SyntaxError: unexpected EOF while parsing
>
is the last line of your file empty ??
what with
for line in filAnsMorph:
# remove any trailing and leading whitespace includes removing \n
line = line.strip()
# Get rid of comment lines
if line.startswith('#'):
continue
# Get rid of blank line
if line == '':
continue
#do the job
x = eval(line)
NB by default strip() removes leading and trailing characters from the target
string. with whitspace defined as whitespace = '\t\n\x0b\x0c\r '
Eric
--
http://mail.python.org/mailman/listinfo/python-list