C:\Users\wuhaoyue\PycharmProjects\pythonProject3\venv\Scripts\python.exe C:\Users\wuhaoyue\PycharmProjects\pythonProject3\main.py File "C:\Users\wuhaoyue\PycharmProjects\pythonProject3\main.py", line 1 with open('C:\Users\wuhaoyue\Desktop\AID申请0515.xlsx 'r') as f: ^ SyntaxError: unterminated string literal (detected at line 1) 进程已结束,退出代码1
时间: 2023-06-20 19:04:03 浏览: 138
这个错误提示是因为在文件路径中的字符串没有正确的结束。可以在路径字符串中的反斜杠之前添加一个额外的反斜杠,或者使用前缀 r 来表示路径字符串是一个原始字符串,例如:
```
with open(r'C:\Users\wuhaoyue\Desktop\AID申请0515.xlsx', 'r') as f:
# do something
```
或者:
```
with open('C:\\Users\\wuhaoyue\\Desktop\\AID申请0515.xlsx', 'r') as f:
# do something
```
阅读全文