Python 3.3 Tutorial Notes - 1:Basic
2015-09-04 23:57
901 查看
1. "/": Division, always return float2. "//": Floor division, return integer3. "%": Reminder, return integer 1. "**": Power 1. Interactive mode, "_" means the value of the last printed expression. "_" is read only. 1. Complex number, use "j" or "J" to indicate the imaginary part -- "5+3j" 1. "..." And '...' are the same in Python2."\" can be used to escape quotes3. '"Yes"' will print out "Yes".4. r"....", mean no escape in the string.5. '"""..."""' or "'''...'''" to indicate a multiple line string. To avoid this, add "\" at the end of the line6. String concatenation: "+" or side by side two string literals next to each other.7. String repeat: <repeat times> * <the string>8. String[i], the i-th char in string. Negative means from the end to the beginning.9. String slicing: Str[0:2], 0 is included, 2 is excluded. Str[:j]: From beginning to j but not include j. Str[k:], from k to the end.10. Python string is immutable 1. List: a=[1, 2, 3]2. the type of element could be different: b=[1, 'a', 5.3]3. string is immutable, list is mutable. For list, assign to a slice is also correct: a[3:5]=["hello", "world"]
1. Multiple-assignment: a,b=0,12. The right-hand expressions evaluate BEFORE assignment3. All right-hand expressions evaluated from left to right.
1. Anything not zero means true in a place where boolean is expect
4000
ed
1. Indentation is important. It is the way to group statements.2. When a compound statement is entered interactively, it must be followed by a blank line to indicate completion (since the parser cannot guess when you have typed the last line).3. Note that each line within a basic block must be indented by the same amount.
1. print(), to avoid new line, use "end" argument: print(b, end=',')
1. Multiple-assignment: a,b=0,12. The right-hand expressions evaluate BEFORE assignment3. All right-hand expressions evaluated from left to right.
1. Anything not zero means true in a place where boolean is expect
4000
ed
1. Indentation is important. It is the way to group statements.2. When a compound statement is entered interactively, it must be followed by a blank line to indicate completion (since the parser cannot guess when you have typed the last line).3. Note that each line within a basic block must be indented by the same amount.
1. print(), to avoid new line, use "end" argument: print(b, end=',')
相关文章推荐
- Python 3.3 Tutorial - Online Resource
- webdriver控制浏览器滚动条 selenium_python
- Python注意事项
- 线程之间的通信
- 使用队列让线程同步
- Python使用条件变量保持线程同步
- Python简单线程同步
- Python线程的daemon属性
- Python线程的线程名
- Python线程isAlive方法
- [转]Python traceback
- Python初学(7)——Python中的作用域基础
- 【Python系列3】两个txt文件通过id进行关联
- python解释器快捷键
- Python语言编程学习资料(电子书+视频教程)下载汇总
- Python新手初学教程
- Python 字符串操作(string替换、删除、截取、复制、连接、比较、查找、包含、大小写转换、分割等)
- wxpython初学者(一)
- python 爬虫获取网站信息(二)
- 3ds max maxscript python 入门--执行python的三种途径