import platform as pf
print(“作業系統:”,pf.system())
print(“系統版本:”,pf.version())
print(“Python版本”,pf.python_version())
import sys
print(“=====sys=======”)
print(sys.path) # 系統路徑
lst = sys.path
print(len(lst))
import time as t
print(“======time=====”)
print(t.time())
tt=t.localtime( t.time() )
print(tt)
#print(tt[tm_year])
print(“現在時間是: %4d年 %2d月 %2d日”\
%(tt.tm_year,tt.tm_mon,tt.tm_mday) )
print(“======random======”)
import random as r
for i in range(6):
print(r.randint(1,49),end=” “)
print()
color= “紅橙黃綠藍靛紫”
for i in range(4):
print(r.choice(color),end=” “) #會重複
print()
print(r.sample(color,7)) #不重複
print()
print(r.sample(range(1,50),6)) #不重複
輸出結果:
自定義函數cake
#自定義函數:
近期留言