您的位置:首页 > 编程语言 > Python开发

note 26/10/2016 basic python

2016-10-26 07:06 218 查看
1. string 可*不可/

'pom' *4    输出'pompompompom'

'pompompompom'/3 输出 error

2. round(2.5) 输出2(不是3)

3. not>and>or

4.'abc'<'bcd' 输出 error 无法比较

5.使用运算符时,记得加括号(优先级问题)

6. list.sort 不返回任何list值给memory

7. 在定义list name时,不要直接定义为list 

8. TypeError: 'NoneType' object is not iterable
http://blog.csdn.net/dataspark/article/details/9953225
27/10/2016

9.巧用alist[-1]=alist[len(alist)-1]

or for i in range(0,len(alist)//2):

alist[0+i]==alist[-1-i]

10. 使用nested list前,除了创建新的list,有时要elements.append([])。否则

IndexError: list index out of range
11. hist(histtype='stepfilled')此部分决定画出的柱状图是否有黑色边界
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: