小玩了下python

来源:互联网 发布:mac怎么查看无线密码 编辑:程序博客网 时间:2024/04/30 00:56
...
The default Python prompt of the interactive shell when entering code for an indented code block or within a pair of matching left and right delimiters (parentheses, square brackets or curly braces).

玩了一下python,是python3.2。  print函数必须加括号的,与之前的版本不同,有空可能会看看,可能就不再看了

 python有个缩进的问题,位于同一层次的语句要统一的缩进

python list
左边第一个数索引为0,也可以从最右边开始,最右边数索引为-1

 a=['spam','eggs',100,6]
>>> a[-1]
6

>>> a[-2]
100

>>> a[3]
6

>>> a[0:3]
['spam', 'eggs', 100]
左闭右开的区间
>>> a[1:-1]
['eggs', 100]

创建固定元素的lis使用replication operator
values = [ None ] * 100000



python输出‘(单引号)需用转义字符\

如果module中有多个类比如A,B

导入时from XXX(模块名) import A,B即可

原创粉丝点击