PythonL: invalid syntax file “”, line 1

后端 未结 5 2062
太阳男子
太阳男子 2021-02-18 22:14

When doing python3 Webhook.py (this is the file), it gives me the error: File \"\", line 1 (%X - %x) ^ SyntaxError: invalid syntax

5条回答
  •  旧巷少年郎
    2021-02-18 22:31

    This happens when anything inside {} is not valid, in a string formatted using the f string formatting prefix. Python 3.7 in my case. The upside is you get the string causing the problem on the error message. You don't get the line number, but it's still easy to figure out once you acknowledge that line number 1 is not the correct line number of the error.

提交回复
热议问题