If you want to create a tarball to backup all of your files to another directory, try this:
tar -cvzpf /newdirectory/newfile.tgz /olddirectory
Then you would expand/restore it like this: tar -C /restoredirectory -xvzpf /newdirectory/newfile.tgz
Or simply tar -xvzpf newfile.tgz to just expand it in place.
The c switch is "create"
The x is "extract"
The z is "gzip" (if supported - depends on distro)
The p is "permissions" (it keeps all your permissions the intact, rather than using umask)
The f is "file"
This won't help you with the python aspect necessarily