![]() |
1
loading 2015-03-19 14:07:11 +08:00 ![]() 你输出到log文件就好很多了,试试。
|
![]() |
2
clino 2015-03-19 14:12:33 +08:00 ![]() 包装一个函数,将字符串都尝试decode成unicode以后再print
因为print u"中文" 在两个平台上都是可以的 |
![]() |
4
Sylv 2015-03-19 14:38:25 +08:00 via iPhone ![]() 想要跨环境的话,这是一种解决办法:
print unicode.encode(sys.stdout.encoding) |
![]() |
5
exoticknight OP |
![]() |
6
icedx 2015-03-19 17:22:20 +08:00 via Android ![]() 封装print
|
![]() |
7
clino 2015-03-19 17:27:55 +08:00
@exoticknight windows下只能支持gb码的打印?如果是这样的话,弄一个gb码里没有的字符当然打不出来了
|
![]() |
8
66450146 2015-03-19 17:32:21 +08:00
用 vagrant 运行就好了。。。。
|
![]() |
9
9hills 2015-03-19 17:44:06 +08:00 via iPhone
和平台无关……
|
![]() |
10
aaaa007cn 2015-03-20 22:33:58 +08:00 ![]() @exoticknight
https://docs.python.org/2/library/codecs.html#codecs.encode Errors may be given to set the desired error handling scheme. The default error handler is 'strict' meaning that encoding errors raise ValueError (or a more codec specific subclass, such as UnicodeEncodeError). Refer to Codec Base Classes for more information on codec error handling. 比如 print u"・".encode(errors="backslashreplace") |