-4

please help. python:

chr(-155) Traceback (most recent call last): File "", line 1, in ValueError: chr() arg not in range(256)

minus value is error to return a specific character ASCII how resolve that problem? Thank you (sorry for bad english)

1 Answers1

3

The integers representing ASCII characters are all positive. A negative integer does not have an equivalent ASCII character. See here for a table of valid ASCII characters.

So the real problem is that your program is accepting improper input. You need to check your input for sanity before attempting to process it.

Community
  • 1
  • 1
Newb
  • 2,810
  • 3
  • 21
  • 35