在cmd中输入 python hello.py
等于直接执行该文件
python一种交互式python解释器
Python按引用传递
a= [1,2,3]
b=a
a.append(4)
Output :b = [1,2,3,4]
属性
attribute a.<>
有一个a.py文件里面有函数f(x),g(x)
在另外一个py文件中可以
Import a 或者 from a import f
a//b a除以b后丢弃小数部分
a**b a的b次方
if
elif
else
x =int(raw_input("Please enter an integer: "))
if x < 0:
x=0
print 'Negative changed to zero'
elif x == 0:
print 'Zero'
elif x == 1:
print 'Single'
else:
print'More'
元组tuple 是一维的,定长的,不可变的()
列表list是变长的,内容可以修改的【】
通过append向末尾添加元素,
Insert可以将元素插入到列表的指定位置b_list.insert(1,’red’) 在第二个位置添加元素,其他的后移
Insert的计算量比append大, 因为后面的数据都要移动
Pop是insert的逆运算
Remove用户删除元素,找到第一个符合要求的 然后删掉
Pass啥都不做