![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
head first python
helixprocess
这个作者很懒,什么都没留下…
展开
-
python learing 3/20
next() 在循环时使用会稍微简单一点 C++ Java Python Perl PHP Shell#!/usr/bin/python3 # Open a file fo = open("foo.txt", "r") print ("Name of the file: ", fo.name) for index in range(5): line = next(fo) prin...原创 2018-03-20 13:32:06 · 119 阅读 · 0 评论 -
head first python
类class是一种将数据与函数链接在一起的东西 类有助于减少复杂性 有利于维护(要通过实践发现他的好处)class起码有一个参数 self 具体用就是创造 实例最好不要 a.time.append() 可能会导致混乱(?) 可以先创立一个方法 变为a.time_append,在使用229...原创 2018-03-24 14:01:30 · 201 阅读 · 0 评论 -
head first python 3/20
.strip()从字符串中去掉不想要的空白符 str = "0000000 Runoob 0000000"; print str.strip( '0' ); # 去除首尾字符 0 str2 = " Runoob "; # 去除首尾空格print str2.strip();open 参数有 'w' 'w+' 'r'... python2中写入可以用.write(...原创 2018-03-21 13:21:52 · 136 阅读 · 0 评论