笨办法学python的笔记之一
2015-10-17 13:30
696 查看
以下是习题18之前的零散笔记
doc下退出python:quit()
py2里的raw_input,到py3里,变成input
Windows 下是 CTRL-Z 来关闭编译器
以下是部分习题的汇总笔记
ex18:
run,call,use 是同一个意思
ex20:
seek(): file.seek(off, whence=0):从文件中移动off个操作标记(文件指针),正往结束方向移动,负往开始方向移动。如果设定了whence参数,就以whence设定的起始位为准,0代表从头开始,1代表当前位置,2代表文件最末尾位置。原文链接
更多seek()解释如下:原文链接
ex32:
class list([iterable])
Lists may be constructed in several ways:
Using a pair of square brackets to denote the empty list: []
Using square brackets, separating items with commas: [a], [a, b, c]
Using a list comprehension: [x for x in iterable]
Using the type constructor: list() or list(iterable)
ex33:
碰到程序跑着停不下来了,这时你只要按着 CTRL 再敲 c (CTRL-c),这样程序就会中断下来了。
ex34:
记住: ordinal == 有序,以 1 开始;cardinal == 随机选取, 以 0 开始。
doc下退出python:quit()
py2里的raw_input,到py3里,变成input
Windows 下是 CTRL-Z 来关闭编译器
以下是部分习题的汇总笔记
ex18:
run,call,use 是同一个意思
ex20:
seek(): file.seek(off, whence=0):从文件中移动off个操作标记(文件指针),正往结束方向移动,负往开始方向移动。如果设定了whence参数,就以whence设定的起始位为准,0代表从头开始,1代表当前位置,2代表文件最末尾位置。原文链接
更多seek()解释如下:原文链接
<span style="font-size:10px;">if you want to read the whole file but skip the first 20 bytes, open the file, seek(20) to move to where you want to start reading, then continue with reading the file. Or say you want to read every 10th byte, you could write a loop that does seek(9, 1) (moves 9 bytes forward relative to the current positions), reads one byte, repeat.</span>
<span style="font-size:10px;">ex25: 试着执行 help(ex25) 和 help(ex25.break_words) 。这是你得到模组帮助文档的方式。 所谓帮助文档就是你定义函数时放在 """ 之间的东西,它们也被称作 documentation comments (文档注解)</span>
ex32:
class list([iterable])
Lists may be constructed in several ways:
Using a pair of square brackets to denote the empty list: []
Using square brackets, separating items with commas: [a], [a, b, c]
Using a list comprehension: [x for x in iterable]
Using the type constructor: list() or list(iterable)
ex33:
碰到程序跑着停不下来了,这时你只要按着 CTRL 再敲 c (CTRL-c),这样程序就会中断下来了。
ex34:
记住: ordinal == 有序,以 1 开始;cardinal == 随机选取, 以 0 开始。
相关文章推荐
- Python集合(set)类型的操作
- Python: 去掉字符串中的非数字(或非字母)字符
- <LeetCode><Easy> 20 Valid Parenthese
- Python input 和 raw_input的区别
- Python web世界观——web架构概览(适合传统程序员)
- python分别使用pip和setup.py安装python module
- <LeetCode><Easy> 14 Longest Common Prefix
- python 爬虫小记
- 3.3.10 使用difflib.unified_diff函数
- Python 代码调试技巧
- python中的可变与不可变
- windows python开发环境搭建及问题解决
- python zeros()使用(from numpy import *)
- python字典
- python变量
- 八大排序算法总结以及python实现
- Python 资源
- python 向上取整ceil 向下取整floor 四舍五入round
- 《Python进阶》学习笔记之Golang
- Python gui开发之tkinter