create a string of variable lenght
benjamin.kaplan at case.edu
Mon Feb 1 19:56:16 CET 2010
On Mon, Feb 1, 2010 at 12:00 PM, Tracubik <affdfsdfdsfsd at b.com> wrote:
> Il Sun, 31 Jan 2010 19:54:17 -0500, Benjamin Kaplan ha scritto:
>> First of all, if you haven't read this before, please do. It will make
>> this much clearer.
> i'm reading it right now, thanks :-)
>> Solution to your problem: in addition to keeping the #-*- coding ...
>> line, go with Günther's advice and use Unicode strings.
> that is: always use the "u" operator (i.e. my_name = u"Nico"), right?
Short answer: yes.
Slightly longer explanation for future reference: This is true for
Python 2 but not Python 3. One of the big changes in Python 3 is that
strings are Unicode by default because you're not the only one who
runs into this problem. So in Python 3, just writing 'Nico' will make
a Unicode string and you have to explicitly declare b'Nico' if you
want to look at it as a series of bytes.
More information about the Python-list