Beware of the Chinese quotation mark trap in Pycharm

Source: Internet
Author: User

Use Pycharm to follow the book hit a piece of Python code, run up total error:

"Unicodeencodeerror: ' ASCII ' codec can ' t encode character ' \u201d '

Then I open the source file that came with the book CD, but it works. previously thought it was there wrong, then i a letter, a punctuation, found no grammar and character errors, continue to error, and then I put myself knocking the code, from the format, symbols, spaces, are adjusted and the CD-ROM with the source file exactly, happy to play everyone to find fault ~ ~ Then 100% Make sure the exact same, run, continue to error! OH MY god! Did I enter the Discovery Discovery Channel?? A word of a word than the right down! One can run, one can't run! Can you understand that feeling?? It was as if the character problem's conclusion could not find any more reasonable explanation ...

Then I looked for an online text comparison tool to see where it was not the same ... And then a miracle happened. even more than a quotation mark! May be the code when the wrong input, and pycharm inside is not shown this Chinese quotation marks!! Then I copied the paste from the Pycharm to Notepad, also show a more than one quotation mark, and copy back the Chinese quotation marks and disappeared!

Try to copy the following text into the Pycharm bar:

I am the Chinese quotation mark "" "" "" "" hoho~~~
I am the English quotation mark "" "" "" "hoho~~~

Then copy it from Pycharm to Notepad:

Oh, by this quote toss for half an hour, Chinese quotation marks are not pycharm intelligent filter, but is hidden! And then silently waiting for the emergence of the hidden trouble ~ So, issued a memorial: "may be able to help other people ~

God Loves you! :)

Beware of the Chinese quotation mark trap in Pycharm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.