跳转底部

2018年6月4日

python函数

摘要: #函数定义 def mylen(): """计算s1的长度""" s1 = "hello world" length = 0 for i in s1: length = length+1 print(length) #函数调用 mylen() ''' ''' def mymax(x,y): the_max = x if x > y... 阅读全文

posted @ 2018-06-04 17:49 afly666 阅读(300) 评论(0) 推荐(0) 编辑

python 文件

摘要: f=open("a.txt","r",encoding="utf-8") #在我的D:/desk/python/project/day03目录下有a.txt文件 data=f.read() print(data) #输出a.txt文件内容123abc #f.close() #关闭文件,回收操作系统级打开的文件 #del f #回收应用程序级的变量,Python会帮我们完成这个,可以不写这条命令... 阅读全文

posted @ 2018-06-04 16:53 afly666 阅读(228) 评论(0) 推荐(0) 编辑

导航

回到顶部