还是在运行《编程小白的第一本python入门书》书上的代码出错:
代码为:
def text_create(name, msg):
desktop_path = 'C:/Users/fuzhi/Desktop/'
full_path = desktop_path + name + '.txt'
file = open(full_path,'w')
file.write(msg)
file.close()
print('Done')
text_create('hello','hello world')
我在notepad++中复制这个代码时,第2到第6行前面的缩进自动给我取消了,
然后解释时出现下面的错误:
把缩进改回来:
结果就对了