CodePudding user response:
Try it,,,
the import the OSThe import zipfile
Flist=OS. Listdir (')
For I in flist:
Fpath=OS. Path. Join ('. ', I)
Fzip=zipfile. Zipfile (I + 'zip', 'w', zipfile. ZIP_DEFLATED)
Fzip. Write (fpath)
CodePudding user response:
Is probably so, change your winrar directory,
The import OS
50 # traversal folder name to file_list
For file_name in file_list:
Run_cmd="'" C: \ Program Files \ WinRAR \ WinRAR exe "{0}." rar {0} ' ' '. The format (filename)
OS. The system (run_cmd)