You can use os.path.expanduser to convert ~ into your home directory:
>>> import os
>>> os.path.expanduser('~/.config.txt')
'/root/.config.txt'
>>>
This works on both *nix and Windows systems.
You can use os.path.expanduser to convert ~ into your home directory:
>>> import os
>>> os.path.expanduser('~/.config.txt')
'/root/.config.txt'
>>>
This works on both *nix and Windows systems.