[python]Windows 下的 ANSI 编码

Date Category python

Windows 下用记事本保存文件时有个 ANSI 编码,那么如何用 python 保存一个 ANSI 编码的文件呢?

python 中使用 mbcs 编码(Windows only)表示 ANSI:

with open('hello.txt', 'w') as f:
    f.write(u'你好'.encode('mbcs'))

执行上面的代码,就可以创建一个 ANSI 编码的文件。

ANSI == Windows 本地编码

在简体中文 Windows 系统中:ansi == gbk :

>>> u'你好'.encode('mbcs')
'\xc4\xe3\xba\xc3 ...
more ...



[英语]IHMO 是什么意思?

有个哥们总是不自觉的跟我说 IHMO,害我看得一头雾水,只好上网找一下解释了:

If you're talking about the commonly used IM/chat/e-mail abbreviation, I think you may have transposed a letter.

"imho" is an acronym for "In my humble opinion."

On the other hand, if you really are asking about "ihmo," I'm afraid I have ...

more ...