Python3 second

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python3 second相关的知识,希望对你有一定的参考价值。

#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的主要内容,如果未能解决你的问题,请参考以下文章

scrapy按顺序启动多个爬虫代码片段(python3)

1 代码片段1

非常有用的 48 个 JavaScript 代码片段

Python3 second

Programing in Python3???Second Edition???_??????

Python代码阅读(第19篇):合并多个字典