I'm using vs code, and when i try to run this:
print(str(chr(257)))
I get this error:ValueError: chr() arg not in range(256)
Asked
Active
Viewed 332 times
-1

Itamar Shubin
- 66
- 7
-
Are you sure it's python3 and not python2 ? – Rahul Bharadwaj Dec 15 '19 at 17:19
1 Answers
2
You seem to be using a Python 2 interpreter to run Python 3 code. As noted in the docs for that function in Python 2.7:
The argument must be in the range [0..255], inclusive; ValueError will be raised if i is outside that range
Switch the interpreter you're using in VS Code to a Python 3 interpreter.

Carcigenicate
- 43,494
- 9
- 68
- 117