Need al little help with programming...
#1
I am trying to figure out a way to search a string for specific information. What I am trying to do is search a file path for Disc numbering.

For example:

/media/freenas/MP3 Music/Full Albums/a/ACDC/Backtracks - CD 1/

I know how to search for a match for a single instance(ie CD 1) but not different ways(CD 1, CD1, Disc 1, Disc1, etc). I know that I need to use a RegEx expression, but most of the documentation I have found on the internet is quite confusing and not always giving enough explanation.

Thanks in advance...
Reply
#2
use re lib.

Code:
match = re.search( ".* - (CD \d)." , "/media/freenas/MP3 Music/Full Albums/a/ACDC/Backtracks - CD 1/ ")
if match:print match
else: print "nothing found"

this will return you "CD 1"
Reply
#3
Thanks once again to get me pointed in the right direction...
Reply
#4
ur welcome Wink

good to see some others start Wink
Reply

Logout Mark Read Team Forum Stats Members Help
Need al little help with programming...0