2017년 11월 4일 토요일

rename from CSV

path = 'Malware500'
tmp_path = 'data'

with open('Malware500.csv','rb') as csvfile:
    reader = csv.reader(csvfile, delimiter = ',')
    for row in reader:
       oldname = os.path.join(path, row[0])
       if os.path.exists(oldname):
           newname = os.path.join(tmp_path, row[1])
           os.rename(oldname, newname)
           print >> sys.stderr, "renamed '%s' to '%s'" % (oldname, newname)
       else:
           print >> sys.stderr, "file '%s' not found" % oldname

댓글 없음:

댓글 쓰기

gpustat command

sudo apt install gpustat watch --color -n0.1 gpustat --color