当前位置:首页 > 编程语言 > 正文

python 函数

11-18 编程语言

标签:name   com   seek   函数   python 函数   file   coding   pen   print   

#函数
def welcome():
print(‘欢迎你‘)
welcome()

def write_file(file_name,cotent):
f = open(file_name,‘a ‘,encoding=‘UTF-8‘)
f.write(cotent)
f.seek(0)
x = f.read()
print(x)
f.close()

write_file(‘a.txt‘,‘今天天气好晴朗‘)

python 函数

标签:name   com   seek   函数   python 函数   file   coding   pen   print   

温馨提示: 本文由杰米博客推荐,转载请保留链接: https://www.jmwww.net/file/biancheng/12075.html