wxjmfa...@gmail.com wrote: > I recommend to toy intensively with the 'EURO SIGN' in > strings manipulations. > > Py3: It may luckily work, Python may crash or fails (it raises > unicode errors on valid string!). > > Py2: It is safer and solid. There is however a subtility. 3rd > party tools may consider the Euro as byte or as unicode and/or > are missinterpreting it, leading to a huge missmatch. > > Example: IDLE > >>>> print 'EURO' * 10 > EURO EURO EURO EURO EURO EURO EURO EURO EURO EURO >>>> print u'EURO' * 10 > >>>> # result: nothing! >>>>
What version of Python do you use ? With IDLE: Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type "copyright", "credits" or "license()" for more information. >>> print("€"*10) €€€€€€€€€€ >>> With IDLE and Python 2.7, there seem to be an encoding problem: >>> s = u"€"*10 >>> >>> import sys >>> sys.stdout.encoding 'utf-8' >>> print s.encode("utf-8") â¬â¬â¬â¬â¬â¬â¬â¬â¬â¬ >>> print s.encode("latin1") €€€€€€€€€€ But with python2 on console, it works nicely: laurent@litchi:~$ python Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> s = u'€' >>> s*10 u'\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac' >>> print s*10 €€€€€€€€€€ > This is not specific to the Euro. I let as an > exercise to *understand* which chars are suffering > from this issue. (Py2 and Py3) > > jmf > > PS Go, Ruby, C#, TeX (unicode engines): never meet a problem. -- https://mail.python.org/mailman/listinfo/python-list