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

MRAB python at mrabarnett.plus.com
Sat Dec 21 20:25:11 EST 2019


On 2019-12-22 00:22, Michael Torrie wrote:
> On 12/21/19 2:46 PM, Ben Hearn wrote:
>> 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'
>                                                                 ^^
> They are actually are different strings.  The name is spelled
> differently between the two.  Móchate vs Móchate (the former seems to
> be the correct spelling according to my inline spell checker).  Is this
> from your own program? I wonder how it got switched?
> 
Use the 'ascii' function to see what's different:

 >>> ascii(a)
"'/Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - 
\\xa1Mo\\u0301chate! _PromoMix_.wav'"
 >>> ascii(b)
"'/Users/macbookpro/Music/tracks_new/_NS_2018/J.Staaf - 
\\xa1M\\xf3chate! _PromoMix_.wav'"
 >>>


More information about the Python-list mailing list