[Tutor] trouble with stringio function in python 3.2
anupama srinivas murthy
anupama.2312.bmsit at gmail.com
Mon May 4 07:03:34 CEST 2015
Hello,
My python code needs to run on versions 2.7 to 3.4. To use stringio
function as appropriate, the code i use is;
if sys.version < '3':
dictionary = io.StringIO(u"""\n""".join(english_words))
else:
dictionary = io.StringIO("""\n""".join(english_words))
The code runs fine on all versions mentioned above except for 3.2 where i
get the error:
dictionary = io.StringIO(u"""\n""".join(english_words))
^
SyntaxError: invalid syntax
How can I solve the issue?
Thank you
Anupama
More information about the Tutor
mailing list