码迷,mamicode.com
首页 > 编程语言 > 详细

Python3 second

时间:2016-10-09 14:14:54      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

#List append
list= [a,b,c,d,e,f,g]
print(list)

list.append(h)
print(list)

list2= [1,2,3,4,5,6,7,6]
list.extend(list2)
print(list)

list.insert(0,x)
print(list)

list.remove(x) #remove value
print(list)

list.pop(0)
print(list)

print(list.index(e))
print(list.count(6))
print(list.count(6))

list.reverse()
print(list)
list.pop()
print(list)
list.pop()
print(list)
list.pop()
print(list)


squares =[]
for x in range(10):
squares.append(x**2)
print(squares)


[print(x*2) for x in squares if x >0]


import time
time1="20071011"
time2="20071012"
t1 = time.strptime(time1, "%Y%m%d")
t2 = time.strptime(time2, "%Y%m%d")
print( t1 < t2)

import datetime
today = datetime.date.today()
print(today.strftime(%Y%m%d))

basket = {apple, orange, apple, pear, orange, banana}
print(basket)

tel = {jack:4390,huang:1216}
print(tel)
print(tel[jack])

 

 技术分享

Python3 second

标签:

原文地址:http://www.cnblogs.com/longsheng/p/5941372.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!