Re: [Tutor] trouble with stringio function in python 3.2

2015-05-04 Thread eryksun
On Mon, May 4, 2015 at 2:46 AM, Chris Warrick wrote: > Python 3.0–3.2 do not support the u'' notation for Unicode strings, it > was restored in Python 3.3 to make it easier to write code compatible > with 2.x and 3.x Whoever restored this forgot about raw literals: >>> ur'abc' File "",

Re: [Tutor] trouble with stringio function in python 3.2

2015-05-04 Thread anupama srinivas murthy
> On May 4, 2015 2:17 AM, "anupama srinivas murthy" < > anupama.2312.bm...@gmail.com> wrote: > >> 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"""\

Re: [Tutor] trouble with stringio function in python 3.2

2015-05-04 Thread Peter Otten
Peter Otten wrote: > anupama srinivas murthy wrote: > >> 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)) >>

Re: [Tutor] trouble with stringio function in python 3.2

2015-05-04 Thread Peter Otten
anupama srinivas murthy wrote: > 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 =

Re: [Tutor] trouble with stringio function in python 3.2

2015-05-04 Thread Chris Warrick
On Mon, May 4, 2015 at 7:03 AM, anupama srinivas murthy wrote: > 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': A better comparison to use would be if sys.version_info[0] == 2: It’s the stand

Re: [Tutor] trouble with stringio function in python 3.2

2015-05-04 Thread Alan Gauld
On 04/05/15 06:03, anupama srinivas murthy wrote: 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: diction

[Tutor] trouble with stringio function in python 3.2

2015-05-04 Thread anupama srinivas murthy
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 co