Le mercredi 20 avril 2011 à 18:40 +0200, Felix Kaiser a écrit :
> If you really need to use unicode symbols in the code, you can fix the
> non-ascii char problem by adding this to the top of the file::
>
> # -*- encoding: utf-8 -*-
>
> ...and then just copy&paste the ⨂ symbol directly into the code.
>
That's probably the best solution. Remember to use only unicode literals
(u'⨂'), not bytestrings ('⨂').
> Or you could use::
>
> >>> print repr("⨂")
> '\xe2\xa8\x82'
> >>> print '\xe2\xa8\x82'
> ⨂
Putting non-ASCII characters in a str is just asking for trouble. Here
you're getting the byte representation of an implicitly UTF-8 encoded
unicode character. That's typically less than helpful, though it usually
works more or less as you might expect as long as you stay on the same
system.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.