On 2008-12-10, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I think this combination might do the trick (I don't have 2.6 to test
> it right now):
> from __future__ import print_function
> from __future__ import unicode_literals
> from functools import partial
> import io
> print = partial(prin
On Dec 10, 10:06 am, [EMAIL PROTECTED] wrote:
> On Dec 10, 6:58 am, Bill McClain
>
>
>
> <[EMAIL PROTECTED]> wrote:
> > On 2008-12-10, ajaksu <[EMAIL PROTECTED]> wrote:
>
> > > On Dec 9, 5:24 pm, Bill McClain <[EMAIL PROTECTED]>
> > > wrote:
> > > > On 2008-12-09, MRAB <[EMAIL PROTECTED]> wrote:
>
On Dec 10, 6:58 am, Bill McClain
<[EMAIL PROTECTED]> wrote:
> On 2008-12-10, ajaksu <[EMAIL PROTECTED]> wrote:
>
> > On Dec 9, 5:24 pm, Bill McClain <[EMAIL PROTECTED]>
> > wrote:
> > > On 2008-12-09, MRAB <[EMAIL PROTECTED]> wrote:
>
> > > > In Python 2.x unmarked string literals are bytestrings.
On 10 Dec 2008 11:58:37 GMT, Bill McClain <[EMAIL PROTECTED]> wrote:
On 2008-12-10, ajaksu <[EMAIL PROTECTED]> wrote:
On Dec 9, 5:24 pm, Bill McClain <[EMAIL PROTECTED]>
wrote:
> On 2008-12-09, MRAB <[EMAIL PROTECTED]> wrote:
>
> > In Python 2.x unmarked string literals are bytestrings. In Pytho
On 2008-12-10, ajaksu <[EMAIL PROTECTED]> wrote:
> On Dec 9, 5:24 pm, Bill McClain <[EMAIL PROTECTED]>
> wrote:
> > On 2008-12-09, MRAB <[EMAIL PROTECTED]> wrote:
> >
> > > In Python 2.x unmarked string literals are bytestrings. In Python 3.x
> > > they're Unicode. The intention is to make the tran
On Dec 9, 5:24 pm, Bill McClain <[EMAIL PROTECTED]>
wrote:
> On 2008-12-09, MRAB <[EMAIL PROTECTED]> wrote:
>
> > In Python 2.x unmarked string literals are bytestrings. In Python 3.x
> > they're Unicode. The intention is to make the transition from 2.x to 3.x
> > easier by adding some features of
Bill McClain wrote:
> On 2008-12-09, Peter Otten <[EMAIL PROTECTED]> wrote:
>
>> >>> out = io.StringIO()
>> >>> print(u"hello", file=out, end=u"\n")
>> >>> out.getvalue()
>> u'hello\n'
>
> That has the benefit of working. Thank you!
>
> That can't be the intended behavior of print(), can it? In
On 2008-12-09, MRAB <[EMAIL PROTECTED]> wrote:
> In Python 2.x unmarked string literals are bytestrings. In Python 3.x
> they're Unicode. The intention is to make the transition from 2.x to 3.x
> easier by adding some features of 3.x to 2.x, but without breaking
> backwards compatibility (not e
Bill McClain wrote:
On 2008-12-09, Peter Otten <[EMAIL PROTECTED]> wrote:
out = io.StringIO()
print(u"hello", file=out, end=u"\n")
out.getvalue()
u'hello\n'
That has the benefit of working. Thank you!
That can't be the intended behavior of print(), can it? Insering non-unicode
spaces and li
On 2008-12-09, Peter Otten <[EMAIL PROTECTED]> wrote:
> >>> out = io.StringIO()
> >>> print(u"hello", file=out, end=u"\n")
> >>> out.getvalue()
> u'hello\n'
That has the benefit of working. Thank you!
That can't be the intended behavior of print(), can it? Insering non-unicode
spaces and line te
Bill McClain wrote:
> I've just installed 2.6, had been using 2.4.
>
> This was working for me:
>
> #! /usr/bin/env python
> import StringIO
> out = StringIO.StringIO()
> print >> out, 'hello'
>
> I used 2to3, and added import from future to get:
>
> #! /usr/bin/env python
On 2008-12-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> This puzzles me too. According to the documentation StringIO accepts
> both byte strings and unicode strings. Try to replace
>output.write('First line.\n')
> with
>output.write(unicode('First line.\n'))
> or
>output.write(st
On Dec 9, 11:28 am, Bill McClain
<[EMAIL PROTECTED]> wrote:
> On 2008-12-08, Bill McClain <[EMAIL PROTECTED]> wrote:
>
> > On 2008-12-08, Christian Heimes <[EMAIL PROTECTED]> wrote:
> > > In this context 'str' means Python 3.0's str type, which is unicode in
> > > 2.x. Please report the misleading
On 2008-12-08, Bill McClain <[EMAIL PROTECTED]> wrote:
> On 2008-12-08, Christian Heimes <[EMAIL PROTECTED]> wrote:
> > In this context 'str' means Python 3.0's str type, which is unicode in
> > 2.x. Please report the misleading error message.
> So this is an encoding problem? Can you give me a
On 2008-12-08, Christian Heimes <[EMAIL PROTECTED]> wrote:
> In this context 'str' means Python 3.0's str type, which is unicode in
> 2.x. Please report the misleading error message.
So this is an encoding problem? Can you give me a hint on how to correct in my
example? I see that io.StringIO()
Bill McClain wrote:
I've just installed 2.6, had been using 2.4.
This was working for me:
#! /usr/bin/env python
import StringIO
out = StringIO.StringIO()
print >> out, 'hello'
I used 2to3, and added import from future to get:
#! /usr/bin/env python
from __future__ imp
I've just installed 2.6, had been using 2.4.
This was working for me:
#! /usr/bin/env python
import StringIO
out = StringIO.StringIO()
print >> out, 'hello'
I used 2to3, and added import from future to get:
#! /usr/bin/env python
from __future__ import print_function
17 matches
Mail list logo