博客已经搬家到“捕获完成”:
https://www.v2python.com
# 函数的练习
def text_create(name,msg):
path = 'c:/test/'
file_path = path + name + '.txt'
file = open(file_path,'w')
file.write(msg)
print('The file is created , its path is: ',file_path)
file.close()
def word_filer(msg,censored_word='hack',repalaced_word='****'):
return msg.replace(censored_word,repalaced_word)
file_name = input('Please input filename: \n')
file_msg = input('Please input something: \n')
text_create(file_name,word_filer(file_msg))
# 函数的练习
建议: 全部都使用使用“/”
例如 path = 'c:/test/'