)
7.1.time and datetime
在Python中,通常有这几种方式来表示时间:
由于Python的time模块实现主要调用C库,所以各个平台可能有所不同
时间戳(timestamp):从...random.uniform(1,3):大于1小于3的小数,如1.927109612082716
random.sample(old_list,5):从list中随机获取5个元素,作为一个片断返回
random.shuffle...# 从list中随机获取N个元素,作为一个片断返回
old_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
new_list = random.sample(old_list..., 5) # 从list中随机获取5个元素,作为一个片断返回
print(old_list)
print(new_list) # 原有序列并没有改变
[1, 2, 3, 4, 5, 6, 7, 8,...或者:
import web.json as json
json.get_json()
每一个包目录下面都会有一个 __init__.py的文件,这个文件是必须存在的,否则Python就把这个目录当成普通目录