Strip operation is removing a character from a url when it shouldnt be <p>I have a strange problem here. I have a list of Youtube urls in a txt file, these aren't normal YT urls though as I believe they were saved from a mobile device and thus they are all like this</p> <p><a href="https://youtu.be/A6RXqx_QtKQ" rel="nofollow">https://youtu.be/A6RXqx_QtKQ</a></p> <p>I want to download the audio from all these urls with youtube-dl for Python so all I need is the 11 digit id so to obtain that I have stripped out everything else from the urls like so:</p> <pre><code>playlist_url = [] f = open('my_songs.txt', 'r') for line in f: playlist_url.append(line.strip('https://youtu.be/')) </code></pre> <p>this works fine for nearly all the urls apart from any that start with 'o' in the 11 digit id e.g. this one</p> <p><a href="https://youtu.be/o5kO4y87Gew" rel="nofollow">https://youtu.be/o5kO4y87Gew</a></p> <p>the 'o' at the start of the digit would not be there and then youtube-dl would stop working saying it couldn't find the proper url or 11 digit id needed to continue. So I went back and printed out all the urls in 'playlist_url' and for the two urls with an 'o' at the start the 'o' is stripped out leaving them with just 10 digits. All other urls are stripped just fine though.</p> <p>why is this happening?</p>