Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

File Name Split on Dashes

Name: Anonymous 2012-01-21 21:32

Hay guys. I'm developing an MP3 player of sorts in Python, and I've devised a way to split a file name by dashes, and return the artist and track separately, but I'm struggling with returning something if no dash is found. In that case, I'd like to return the original file name, and an empty string. As it is now, if no dash is found in a file name, it will just return "None".

Here is my function:

def parseName(song):
    flags = chr(6), chr(45), chr(173), chr(8211)
    for flag in flags:
        for letter in song:
            if flag == letter:
                        return song.split(flag)

Could anyone help? I'd appreciate it.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List