摘要: #!/usr/bin/env python# -*- encoding:utf-8 -*-'''def 关键字 函数名(设定与变量相同): 函数体'''#my_len()求长度函数# def my_len(l):# count=0# for i in l:# count+=1# return cou 阅读全文
posted @ 2018-04-17 18:17 非非不可 阅读(114) 评论(0) 推荐(0)
摘要: #!/usr/bin/env python# -*- encoding:utf-8 -*-#创建文件句柄#方式1,必须做关闭文件的操作f1=open('a.txt',encoding='utf-8',mode='r')#r模式要求文件已经存在print(f1.read())f1.close()#方式 阅读全文
posted @ 2018-04-17 15:35 非非不可 阅读(103) 评论(0) 推荐(0)