import os print os.path.join("c:\\music\\ap\\", "test.txt") print os.path.join("c:\\music\\ap", "test.txt") print os.path.expanduser("~") print os.path.join(os.path.expanduser("~"), "Python")