python-3.x - 溢出错误:字符参数不在范围内(0x110000)在 python 3.5 中使用 getch
问题描述
我在 ubuntu 中使用 getch 得到溢出错误。这是代码:
import getch
print("Inserisci 8 caratteri esadecimali: ")
allowedChar = '0123456789abcdefABCDEF'
contatore = 0
uuid = ""
while contatore < 8:
char = getch.getch() # User input, but not displayed on the screen
if char in allowedChar:
print(char, end="", flush=True)
contatore = contatore + 1
uuid = uuid + char
uuid = uuid + "-"
print(uuid)
我必须输入一个 UUID,但我只想显示允许的字符(十六进制数字),但是当我输入“è”或“ù”或“ò”或“à”时,我收到此错误:
Traceback (last recent call last): File "Char.py", line 7, in char = getch.getch() # 用户输入,但未显示在屏幕上 OverflowError: character argument not in range(0x110000).
请我需要克服这个错误。我需要帮助。我没有使用 Windows。
解决方案
推荐阅读
- perl - 无法使用 perl 模块 HTTP::Request::Generator 传递自定义标头
- perl - Perl grep 命令用于嵌套哈希而不是使用循环
- java - Curator 5.x 与 Zookeeper 客户端 3.5.x 和 Zookeeper 服务器 3.4.x
- java - 如果页面未加载 30 秒,如何停止 Web 视图并显示重新加载消息?
- java - 无法将 String 解析为 Long 并在列表中使用它
- postgresql - PostgreSQL OID 会随时间变化吗?
- html - CSS 翻译不适用于 flex-box 元素
- python - 如何在不删除(弹出)它的情况下访问 heapq 中的顶部元素 python?
- anaconda - 启动 spyder 时,spyder 内核显示此错误。并且 anaconda 也没有安装其他环境
- mysql - 使用子查询查看单个表中两个表的不同列