How to deal with Non-ASCII Warning when performing Save on Python code edited with IDLE?

耗尽温柔 提交于 2019-12-14 02:19:10

问题


I frequently edit Python code using IDLE and occasionally when I perform a Save I receive an I/O Warning.

I am assuming that I have inadvertently added a Non-ASCII character, and I do not really want to declare the cp1252 encoding.

Is there an easy way to find and delete the Non-ASCII that the Warning relates to?

The OS Version involved is Windows 7, and the Python version is 2.6.5


回答1:


The regex [^ -~] will match anything except printing ASCII characters. It should be able to find your stray non-ASCII character.

Use it with IDLE's Search dialogue (Ctrl + F, or Edit → Find); it can search by regex:



来源:https://stackoverflow.com/questions/16270174/how-to-deal-with-non-ascii-warning-when-performing-save-on-python-code-edited-wi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!