I want to use Python to edit ~/.bash_profile, but when I run these codes:
f = open('~/.bash_profile', 'rb')
it told me:
IOError: [Errno 2] No such file or directory: '~/.bash_profile'
I thought it was because ~/.bash_profile is a system protect file.
Is there any method to open this file by using Python?