random
# coding=utf-8
import random
# print(random.random())
# print(random.randint(1,3)) # 范围[1,3]
# print(random.randrange(1,3)) # 范围[1,3)
#
# # 可对指定的列表进行随机取
# print(random.choice([11,22,33]))
#
# # 指定随机取几个数
# print(random.sample([11,22,33,44],2))
#
# # 任意范围的浮点型
# print(random.uniform(1,4))
#
# # 打乱顺序
# item = [1,2,3,4,5,6]
# random.shuffle(item)
# print(item)
time
# coding=utf-8
import time
# 时间戳
# print(time.time())
#
# # 结构化时间-----当地时间
# print(time.localtime()) # time.struct_time(tm_year=2019, tm_mon=8, tm_mday=27, tm_hour=11, tm_min=42,
# # tm_sec=53, tm_wday=1, tm_yday=239, tm_isdst=0)
# t = time.localtime()
# print(t.tm_year) # 2019
# # ------世界标准时间,与之差8小时---UTC
# print(time.gmtime())
# ----将结构化时间转换成时间戳
print(time.mktime(time.localtime()))
# -----将结构化时间转换成字符串时间
print(time.strftime('%Y-%m-%d %X',time.localtime()))
# ----将字符串时间转化成结构化时间
print(time.strptime('2019-10-10 12:12:32','%Y-%m-%d %X'))
print(time.asctime()) # 结构化时间做参数转换
print(time.ctime()) # 时间戳做参数转换
# time.sleep() # 进程睡眠时间
import datetime
print(datetime.datetime.now()) #2019-08-27 12:14:04.270979 ,默认时间格式
json&pickle
# coding=utf-8
# dic = '{"name":"alex"}'
# f = open('hello','w')
# f.write(dic)
# f.close()
# 使用eval()
# f_read = open('hello','r')
# data = f_read.read()
# print(type(data))
# data = eval(data)
# print(data['name'])
# f_read.close()
# 使用json json会将所有的引号变成双引号最终变成字符串
# import json
# dic = {"name":"alex"}
# f = open('new_hello','w')
# data = json.dumps(dic)
# f.write(data)
# 上面相当于下面
# json.dump(data,f)
# f = open('hello','r')
# data1 = json.loads(f.read())
# 上面相当于下面
# data1 = json.load(f)
# print(data1)
# print(type(data1))
# print(data)
# print(type(data))
# print(json.dumps([11,22]))
# print(json.dumps('hello'))
# ---------------------pickle-------
# import pickle
# # 支持几乎所有
# dic = {'name':'alvin'}
# j = pickle.dumps(dic)
# 其使用方法与json相同,不同的是json最后是字符,pickle是字节,所以文件得用wb,rb模式
# ----------------shelve模块
# import shelve
#
# f = shelve.open(r'shelve')
#
# f['stu1'] = {'name','alex'}
# f.close()
#
# print(f.get('stul')['age'])
os
# coding=utf-8
import os
# os.getcwd() # 获取当前工作mul
# os.chdir()
# os.makedirs()
# os.removedirs()
# os.mkdir()
# os.rmdir()
# os.listdir()
# os.remove()
# os.rename()
# os.stat()
# os.linesep
# os.pathsep
# os.path.abspath()
# os.path.split()
# os.path.dirname()
# os.path.basename()
# os.path.exists()
# os.path.isabs()
# os.path.isfile()
# os.path.isdir
# os.path.join()
# os.path.getatime()
# os.path.getmtime()
sys
# coding=utf-8
import sys
import time
# sys.argv # 命令行参数List,第一个元素是程序本身路径
# sys.exit(n) # 退出程序,正常退出时exit(0)
# sys.version # 获取python解释器的版本信息
# sys.maxint # 最大的Int值
# sys.path # 返回模块的搜素路径,初始化时使用的PYTHONPATH环境变量的值
# sys.platform # 返回操作系统平台名称
#
# print(sys.argv)
for i in range(100):
sys.stdout.write('#')
time.sleep(0.05)
sys.stdout.flush()