try:
print(filePath)
my_file = Path(filePath)
except ValueError:
print ValueError
Der Versuch, diesen Code auszuführen hält einen Fehler werfen:Kann nicht Pfad (Datei) verwenden, ohne eine Ausnahme auszulösen
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 26: ordinal not in range(128)
Der Wert es Sprengung ist: Kellyanne Conway: Giuliani’s Withdrawal From Consideration A ‘Mutual Decision’ | MTP Daily | MSNBC.opus
Ich habe versucht, diese Zeichenfolge in Ascii und Unicode zu kodieren und es hat nicht funktioniert. Wie kann ich überprüfen, ob die Datei korrekt existiert? Danke.
Und was ist 'Path'? – TigerhawkT3
'von pathlib Import Path' – Antoine
Python 2 oder Python 3? Es ist wichtig. Siehe http://stackoverflow.com/questions/33938079/why-python2-and-python3-treat-same-windows-directory-differently und https://pypi.python.org/pypi/pathlib/ (Suche nach "ASCII ") –