摘要: codecs 模块: 处理文件操作过程中的乱码问题。 f=codecs.open('fxh.txt','r+') #打开文件 打开的模式: r , w , a ,b , r+ , w+ .... 常用的方法: read() 读取文件中内容 write() 写入内容,必须传入字符串 writeline 阅读全文
posted @ 2017-10-27 23:40 xuanhui 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1、计算1--100的和: >>> n=0>>> for x in range(101):... n=x+n...>>> print(n)5050>>> 2、计算1 500内的奇数和: >>> for x in range(501):... if x%2 != 0:... n=x+n...>>> p 阅读全文
posted @ 2017-10-27 00:28 xuanhui 阅读(130) 评论(0) 推荐(0) 编辑