#python Python Japanese syntax error avoidance

I started python.

I'm using pyChram on my Mac. The story of environment construction is separate.

This time, when I used Japanese in the code, I immediately got a Syntax Error.

''SyntaxError: Non-ASCII character '\xa3' in file''

When dealing with Japanese

test.py


# -*- coding: utf-8 -*-
__author__ = 'ashibuya'

queries=['Mozart', 'Beethoven','Haydn']
for q in queries:
    print q

queries=[u'Mozart', u'Beethoven',u'Haydn']
for q in queries:
    print q


Reference site
http://stackoverflow.com/questions/10589620/syntaxerror-non-ascii-character-xa3-in-file-when-function-returns


Recommended Posts

#python Python Japanese syntax error avoidance
Python error list (Japanese)
[Python] SQLAlchemy error avoidance memorandum
with syntax (Python)
Python syntax-control syntax
When Python "Syntax Error: Non-ASCII character ~" appears
Resolve Japanese write error UnicodeEncodeError in Python files
Python Not Implemented Error
Today's python error: killed
Python control syntax (memories)
Japanese output in Python
python Environmentally-friendly Japanese setting
[Python] for statement error
Send Japanese email with Python3
I wrote python in Japanese
Python: Japanese text: Morphological analysis
Scraping using Python 3.5 Async syntax
Japanese NLP @ janome / spaCy / Python
[youtube-dl] python3 SSL error (CERTIFICATE_VERIFY_FAILED)
Ruby and Python syntax ~ branch ~
Slice error in python (´ ; ω ; `)
I understand Python in Japanese!
tesseract-OCR for Python [Japanese version]
Error resolution python version check
Get Japanese synonyms in Python
Python control syntax, functions (Python learning memo ②)
[python] Error when installing library ramkan
Today's python error: SyntaxError Non-ASCII character
Error when building mac python environment
Python error: ModuleNotFoundError: No module named'flask'
New syntax for Python 3.8 [assignment formula]
Add Python 2.7 Japanese documentation to Dash.app
Today's python error: image is blank
Python error detection run from Powershell
Speak Japanese text with OpenJTalk + python
How to handle Japanese in Python
Strange and horrifying Python error story
Japanese prettyprint memo (also python2.7 & 3.5 windows7)