time,random,datetime

发布时间 2023-04-23 23:32:44作者: sangern

 

 

import time
print(time.time())

import random
from random import randint

random.choice


import datetime
year = datetime.datetime.now().year
month = datetime.datetime.now().month
print(year , month)

a=2
b=8
c=9
a,b,c = c,a,b
print(a,b,c)

tuple = (1,2,3,4)
print(tuple[1:3])
# tuple[2]=3 出错,tuple不能修改

st1,st2,st3 = (1,2,3) # 等效于 st1,st2,st3 = 1,2,3   如果不加括号,将会被自动视为元组
print(st1,st2,st3,sep=' & ')

mylist = [3,'this',6.2]
mylist.extend([3,4])
print(mylist)
mylist.pop()
print(mylist)
print(mylist.index('this'))
mylist.sort()
print(mylist)