第八章、 第一个python程序

#!/usr/bin/env python
import os
import sys
import time 

source = [r'G:\s1', r'G:\s2']
target_dir = r'G:\d' + os.sep 

today = target_dir + time.strftime('%Y%m%d')
now = time.strftime('%H%M%S') 

comment = raw_input('Enter a commnet -->')
if  len(comment) == 0:
    target = today + os.sep + now
else:
    target = today + os.sep + now + \
    '_' + comment.replace(' ','_') 

if not os.path.exists(today):
    os.mkdir(today) 

rar_command = r"D:\WinRAR\rar.exe a" + " %s %s" %(target, ' '.join(source)) 

if os.system(rar_command) == 0:
    print "pass"
else:
    print "fail"

相关文章:

  • 2022-12-23
  • 2022-02-26
  • 2021-11-14
  • 2021-11-05
  • 2021-11-05
  • 2021-11-05
  • 2021-11-05
  • 2021-11-05
猜你喜欢
  • 2021-11-19
  • 2021-07-28
  • 2021-11-15
  • 2022-03-08
  • 2022-02-06
  • 2022-01-12
相关资源
相似解决方案