Python如何调用rar命令
通过os模块的system()方法调用了系统的rar.exe命令,这个方法会返回一个变量exit_status。
相关推荐:《Python教程》
importos importtime source=[r‘D:\Work\Python\Demo‘,‘d:\\work\\linux‘] target_dir=‘D:\\Work\\backup\\‘ target=target_dir+time.strftime(‘%Y%m%d%H%M%S‘)+‘.rar‘ zip_command="rara%s%s"%(target,‘‘.join(source)) ifos.system(zip_command)==0: print‘Sucessfulbackupto‘,target else: print‘BackupFailed‘
本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.