Import sys
#encoding utf-8
def fun(postex,msg):
path=“E:\variousDocument”;
FullPath=path+“不同文档.”+postex
f=open(fullpath,‘w’)
f.write(msg)
f.close()
print(“Done”)
arr=[“txt”,“docx”,“xlsx”,“ppt”]
str=""
print(“请输入要创建的文件类型:\n”)
for i in arr:
str+=i+"\t"
postex=raw_input()
msg=raw_input(“请输入文档内容”)
if(postex not in arr):
Print (“请输入正确的文档格式”)
else:
fun(postex,msg)