python
html hsdata_file_name_change(途ä¸ï¼‰
import re
import glob
import os
import shutil
import csv
# åŒãƒ•ã‚©ãƒ«ãƒ€å†…ã®htmlファイルåã‚’å–å¾—
file_name = glob.glob('*.csv')[0]
if "~" not in file_name:
print("実行ã™ã‚‹")
# ã“ã“ã«ã‚³ãƒ¼ãƒ‰ã‚’記述
f = open(file_name)
reader = csv.reader(f)
l = [row for row in reader]
beginning=l[1][0]
ending=l[-1][0]
beginning.split("/")
start_date=beginning.split("/")[2] + "-" + beginning.split("/")[0] + "-" + beginning.split("/")[1]
ending.split("/")
end_date=ending.split("/")[2] + "-" + ending.split("/")[0] + "-" + ending.split("/")[1]
start_date + "~" + end_date
new_file_name=file_name.replace("FromDownloader","")
new_file_name=new_file_name.replace("_BidAndAsk","")
new_file_name = new_file_name + "["+start_date + "~" + end_date+"]"
f.close()
os.rename(file_name,new_file_name)
else:
print("実行ã—ãªã„")
Was this helpful?
Similar Posts