I have an application which should display to the user the path to a file. Let's say the user inputs /home/me/foo/, the application should shorten that to ~/foo.
Is there any way to do this in Python such that it works cross-platform with Linux and Windows?