import os print os.path.split("c:\\a\\b\\c.mp3") (filepath, filename) = os.path.split("c:\\a\\b\\c.mp3") print filepath print filename (shortname, extension) = os.path.splitext(filename) print shortname print extension