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

Ben Hearn benandrewhearn at gmail.com
Sun Dec 22 10:38:08 EST 2019


On Saturday, 21 December 2019 21:46:43 UTC, Ben Hearn  wrote:
> 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

Thanks for the help on this, normalizing my string fixed up the problem cheers!


More information about the Python-list mailing list