==============================================================
1、元组以及in的一些操作:
tuple1 = [55, 'NT' , 71 , 99]
55 in tuple1
#输出True;
----------------------------------------------------------------------------------------------------------2、三目运算符
value = "value1" if value1>value2 else "value2"
print (value)
#输出value1与value2中较大的一个;
----------------------------------------------------------------------------------------------------------
3、zip的使用
name = ["Alice","John","jack"]
phone = ["123123","321321","123456"]
zip(name,phone)
#输出元组 [ ( "Alice" , "123123" ) , ( "John" , "321321" ) , ( "jack" , "123456" ) ]
------------------------------------------------------------------------------------------------------------
4、enumerate的使用
list1 = [ 'Alice' , 'John' , 'jack' ]
for index , name in enumerate(list1):
print (index ,' name is ', name)
#输出 0 name is Alice
#输出 1 name is John
#输出 2 name is Jack
-------------------------------------------------------------------------------------------------------------
5、for 中的else语句
list = [1,2]
for x in list:
pass
else:
print("else")
#输出 else , for 不被break和continue打断,正常循环结束之后即执行else中的语句;
-------------------------------------------------------------------------------------------------------------