0
Wenn ich openpexl Operating Excel verwende, löst der folgende Code den Fehler aus. Ich kann den Grund nicht herausfinden.OSError: [Errno 22] Ungültiges Argument in load_workbook
wb=load_workbook(r'C:\Users\Administrator\Desktop\11.xls')
Fehlermeldung:
C:\Users\Administrator\AppData\Local\Programs\Python\Python36\python.exe
C:/Users/Administrator/Desktop/data_process.py
Traceback (most recent call last):
File "C:/Users/Administrator/Desktop/data_process.py", line 3, in <module>
wb = load_workbook(r'C:\Users\Administrator\Desktop\11.xls')
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\reader\excel.py", line 171, in load_workbook
archive = _validate_archive(filename)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\reader\excel.py", line 118, in _validate_archive
archive = ZipFile(filename, 'r', ZIP_DEFLATED)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\zipfile.py", line 1082, in __init__
self.fp = io.open(file, filemode)
OSError: [Errno 22] Invalid argument: '\u202aC:\\Users\\Administrator\\Desktop\\11.xls'
Wenn Sie sich die Fehlermeldung ansehen, sehen Sie, dass Sie ein '\ u202a'-Zeichen in Ihrem Pfad haben. –
Siehe [this link] (http://www.fileformat.info/info/unicode/char/202a/index.htm) über ''\ u202a'' char – Shai
Funktioniert es, wenn Sie' \\ 'statt verwenden '/'? –