14.01.2013 14:44, Matthew Brett kirjoitti: [clip] > Pierre's suggestion is good; you can also do something like this: > > # -*- coding: utf8 -*- > import sys > > if sys.version_info[0] >= 3: > a = 'öäöäöäöäöåååå' > else: > a = unicode('öäöäöäöäöåååå', 'utf8') > > The 'coding' line has to be the first or second line in the file.
Another useful option would be from __future__ import unicode_literals This makes the literal 'spam' be unicode also on Python 2, so that b'spam' is bytes. This might make unicode unification easier. OTOH, it might open some cans of worms. -- Pauli Virtanen _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion