I am trying to create a Python 3 program on Windows 10 that loops through Unicode characters, but on the last empty line, it has the error of
SyntaxError: unexpected EOF while parsing
I tried putting a print("Done!")
at the end but that said IndentationError: unexpected unindent
.
max = int("FFFC",16)
min = 0
for x in range(max + 1):
try:
hex_value = hex(x)
proper = str(hex_value)[2:].upper()
while len(proper) != 4:
proper = "0" + proper
proper = "U+" + str(proper)
print(f"{proper} : {chr(x)}")
Error:
File "unicode.py", line 11
^
SyntaxError: unexpected EOF while parsing
This is in the last line of code (where it is blank).
每次try
都需要包含一条except
语句。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.