Hi,

No, I’ve checked leading/trailing whitespace, it seems to be related to the 
variables that are returned from eyed3 in this case, for instance, I added a 
check for None:
myTitleName = myID3.tag.title
if myTitleName is None:
    continue
Seems like it can return a null object (or none?).

 
> On 7 Jun 2022, at 22:35, De ongekruisigde 
> <ongekruisi...@news.eternal-september.org> wrote:
> 
> On 2022-06-07, Dave <d...@looktowindward.com 
> <mailto:d...@looktowindward.com>> wrote:
>> Thanks a lot for this! isDigit was the method I was looking for and couldn’t 
>> find.
>> 
>> I have another problem related to this, the following code uses the code you 
>> just sent. I am getting a files ID3 tags using eyed3, this part seems to 
>> work and I get expected values in this case myTitleName (Track name) is set 
>> to “Deadlock Holiday” and myCompareFileName is set to “01 Deadlock Holiday” 
>> (File Name with the Track number prepended). The is digit test works and 
>> myCompareFileName is set to  “Deadlock Holiday”, so they should match, 
>> right? 
>> 
>> However the if myCompareFileName != myTitleName always gives a mismatch! 
>> What could cause two string that look the fail to not match properly?
> 
> Possibly leading or trailing spaces, or upper/lower case differences?
> 
> 
>> myCompareFileName = myFile
>> if myCompareFileName[0].isdigit() and myCompareFileName[1].isdigit():
>>    myCompareFileName = myCompareFileName[3:]
>> 
>> if myCompareFileName != myTitleName:
>>    print('File Name Mismatch - Artist: ',myArtistName,'  Album: 
>> ',myAlbumName,'  Track:',myTitleName,'  File: ',myFile)
>> Thanks a lot
>> Dave
>> 
>>> On 7 Jun 2022, at 21:58, De ongekruisigde 
>>> <ongekruisi...@news.eternal-september.org> wrote:
>>> 
>>> On 2022-06-07, Dave <d...@looktowindward.com> wrote:
>>>> Hi,
>>>> 
>>>> I’m new to Python and have a simple problem that I can’t seem to find the 
>>>> answer.
>>>> 
>>>> I want to test the first two characters of a string to check if the are 
>>>> numeric (00 to 99) and if so remove the fist three chars from the string. 
>>>> 
>>>> Example: if “05 Trinket” I want “Trinket”, but “Trinket” I still want 
>>>> “Trinket”. I can’t for the life of work out how to do it in Python?
>>> 
>>> 
>>> s[3:] if s[0:2].isdigit() else s
>>> 
>>> 
>>>> All the Best
>>>> Dave
>>>> 
>>> 
>>> -- 
>>> <StevenK> You're rewriting parts of Quake in *Python*?
>>> <knghtbrd> MUAHAHAHA
>>> -- 
>>> https://mail.python.org/mailman/listinfo/python-list
>> 
> 
> 
> -- 
> <StevenK> You're rewriting parts of Quake in *Python*?
> <knghtbrd> MUAHAHAHA
> -- 
> https://mail.python.org/mailman/listinfo/python-list 
> <https://mail.python.org/mailman/listinfo/python-list>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to