Today's python error: SyntaxError Non-ASCII character

Program change (5) python median https://qiita.com/kaizen_nagoya/items/2f02d5f8af808e322e3c

Encountered while working trying to check with docker.

Installed with apt install python2.7 with docker. Edit with vi

# python2.7 median.py
  File "median.py", line 4
SyntaxError: Non-ASCII character '\xe8' in file median.py on line 4, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

The contents of the python file

median.py


# https://qiita.com/manzyun/items/833ae7fba582d899c618
data = [100, 300, 423, 328, 516, 412]

data.sort() # **?~E large?~K**

if len(data) % 2 == 0: # ?~C??~B??~C~H?~A??~A?| ?~A??~U??~A??~G?~U??~C??~A??~~
U??~H??~Z
    # ?~A??~U??~A??~A~W?~A~_
    m1 = len(data) / 2
    m2 = (len(data) / 2) + 1
    # ?~U??~U??~A??~I?~O~[?~A~W?~A??~M place?~P~H?~B~O?~A~[
    m1 = int(m1) - 1
    m2 = int(m2) - 1
    print(data[m1] + data[m2]) / 2
else:
    # ?~G?~U??~A??~A~W?~A~_
    m = (len(data) + 1) / 2
    m = int(m) - 1
    print(data[m])

Recommended Posts

Today's python error: SyntaxError Non-ASCII character
When Python "Syntax Error: Non-ASCII character ~" appears
Today's python error: killed
Today's python error: image is blank
Today's python error: ModuleNotFoundError: No module named
Today's python error: ModuleNotFoundError: No module named
[EC2] Error: Remedy for Non-ASCII character'\ xe8'
Today's python error: ModuleNotFoundError: No module named'requests'
Today's python error: ModuleNotFoundError: No module named'bs4'
python character code
Python today's dog
Python Error Handling
python> Copy and paste code> SyntaxError: Non-ASCII character'\ xe3' in file>-*-coding: utf-8-*-Add
Today's python error: UnicodeEncodeError:'ascii' codec can't encode characters
Today's python error: UnicodeEncodeError:'utf-8' codec can't encode characters
Python Node.js character manipulation
Python Not Implemented Error
Today's python error: HTTPError: 404 Client Error: Not Found for url:
About Python3 character code
Today's python error: invalid keyword argument for this function
Python error list (Japanese)
[Python] for statement error
Manipulating Python character lists (arrays)
3-3, Python strings and character codes
[Python] SQLAlchemy error avoidance memorandum
2.x, 3.x character code of python
[youtube-dl] python3 SSL error (CERTIFICATE_VERIFY_FAILED)
Error when playing with python
#python Python Japanese syntax error avoidance
Slice error in python (´ ; ω ; `)
Character code learned in Python
Python f character (formatted string)
Error resolution python version check