from datetime import datetime
import re
path='/home/siyanlou/output_1981.10.21.txt'
haha=os.path.basename(path)
format="output_%Y.%m.%d.txt"
t=datetime.strptime(haha,format)
s=t.weekday()+1
S=str(s)
os.rename("/home/shiyanlou/output_1981.10.21.txt","/home/shiyanlou/output_1981-10-21-"+S+".txt")