import os
txt = 1
mmyyyy = ' -08-2020 '
for f in range (1,1001):
for i in range (1,11) :
if not os.path.exists('C:\\Users\\Hayavadan\\OneDrive\\Python\\' + str(i) + mmyyyy):
os.mkdir ("C:\\Users\\Hayavadan\OneDrive\Python\\" + str (i) + mmyyyy)
open ("C:\\Users\\Hayavadan\\OneDrive\\Python\\1 -08-2020\\" + str(f) + txt , "w")
else:
os.rmdir ("C:\\Users\\Hayavadan\OneDrive\Python\\" + str (i) + mmyyyy)
错误
======== RESTART: C:/Users/Hayavadan/OneDrive/Python/delete by hayu 3.py =======
Traceback (most recent call last):
File "C:/Users/Hayavadan/OneDrive/Python/delete by hayu 3.py", line 8, in <module>
open ("C:\\Users\\Hayavadan\\OneDrive\\Python\\1 -08-2020\\" + str(f) + txt , "w")
TypeError: can only concatenate str (not "int") to str
holdtom
明月笑刀无情
忽然笑
相关分类