发生异常: NameError
name 'new_path' is not defined
import os
path = ' '
extension = 'html'
for i in range(1,len(path)):
if (path[-i] == '.'):
new_path = path.replace(path[-i+1:],extension)
break
os.rename(path,new_path)
command = new_path
os.system(command)