I'm writing a script in python, but not able to use multiple stings in cases like check directory, file creation etc,
I'm using this to get user input : drive = raw_input('enter drive name to make backup ')
if not os.path.exists('/media/%s/backup' %drive):
os.mkdir('/media/%s/backup' %drive)
The above code is working, but the tarfile below is giving an error........
./backup4.py
enter drive name to make backup PENDRIVE
Traceback (most recent call last):
File "./backup4.py", line 17, in <module>
tarFile = tarfile.open("/media/%s/backup/%s.tar.bz2" %drive %dateVar, 'w:bz2')
TypeError: not enough arguments for format string
tarFile = tarfile.open("/media/%s/backup/%s.tar.bz2" %drive %dateVar, 'w:bz2')
what changes should i make to above tarfile.open??