Python Basic
来源:互联网 发布:网站注册域名 编辑:程序博客网 时间:2024/05/17 09:22
1. swap two elements
a, b = b, a #fk, it is so easy.
2. Chained Logical
a < b <= c <d
same with:
a< b and b<=c and c<d
#lol, I love python, easy easy and easy
3. Indexing a sequence
x = [1,2,3,4]
x [1] #2
x[2:] #2,3,4
x[-1] #4
del x[1] #x = [2,3,4]
4. Iterators using "for"
for x in c:
statement(s)
5. List comprehensions
1: a = [1,2,3,4,5]
2: result1 = [x for x in a]
3: print result1
4: #print out [1,2,3,4,5]
5: #This is equals to
6: result1 = []
7: for x in a:
8: result1.append(x)
6. Parameters (* & **)
*identifier indicates that any call to the function may supply extra positional arguments
**identifier indicates that any call to the function may supply extra named agruments.
- Python Basic
- Python Basic
- python basic
- python basic
- Python Basic
- Python Basic
- Python----Basic
- Python Basic
- Python 2 basic
- python regular expression basic
- Basic OOP in Python
- python Basic Authentication
- PAT basic 1036 python
- Python basic interview questions
- Python basic note 01
- Python 编码Basic Auth
- basic algorithm in python
- Python Basic Examples
- 孙鑫VC视频教程笔记之第九课“程序外观修改及工具栏状态栏编程”
- ZedGraph横坐标显示日期
- SVN update commands
- 三个查询接口
- 黑基
- Python Basic
- 功能测试
- 一个台湾牛人写的很不错directshow相关知识
- oracle内置程序包
- 行业网站性能问题的反思
- 存储器分页管理机制
- PKU 1743 Musical Theme
- JDK5的ProcessBuilder介绍和使用实例
- 抵制日货从思想上做起