urllib unqoute providing string mismatch between string found using os.walk (Python3)

Ben Hearn benandrewhearn at gmail.com
Sat Dec 21 16:46:31 EST 2019


Hello all,

I am having a bit of trouble with a string mismatch operation in my tool I am writing.

I am comparing a database collection or url quoted paths to the paths on the users drive.

These 2 paths look identical, one from the drive & the other from an xml url:
a = '/Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate! _PromoMix_.wav'
b = '/Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate! _PromoMix_.wav'

But after realising it was failing on them I ran a difflib and these differences popped up.

import difflib
print('\n'.join(difflib.ndiff([a], [b])))
- /Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate! _PromoMix_.wav
?                                                                                                      ^^
+ /Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - ¡Móchate! _PromoMix_.wav
?                                                                                                      ^


What am I missing when it comes to unquoting the string, or should I do some other fancy operation on the drive string?

Cheers,

Ben


More information about the Python-list mailing list