10 2020 档案

摘要:#文件写入 import os os.chdir('C:/Users/11786/Desktop/') f_w = open('text_w.txt','w',encoding = 'utf8') f_w.write('hello world') f.close() #wrirtelines f_w 阅读全文
posted @ 2020-10-26 17:36 秃头统治世界
摘要:#文件数据读写的基本操作 import this #本地文件的界定:指向一个本地存储的文件,是一个连接或者一个映射 path1 = 'C:\\Users\\11786\\Desktop\\test.txt'#正斜线两个或者反斜线一个来用于数据路径的表达 再或者用r 写在文件路径外面 推荐第三种 pa 阅读全文
posted @ 2020-10-26 17:33 秃头统治世界 阅读(213) 评论(0) 推荐(0)
摘要:# 编写一个求平均值的函数 def f(*m): s = 0 lst = [] for i in m: while str(i).isnumeric(): s += i lst.append(i) else: print('输入端内的内容包含有非法数字') return (s / len(lst)) 阅读全文
posted @ 2020-10-25 17:08 秃头统治世界 阅读(126) 评论(0) 推荐(0)