美文网首页
2019-03-18

2019-03-18

作者: Jason_2809 | 来源:发表于2019-03-18 10:29 被阅读0次

#常用模块

# collections中的方法

#os  和操作系统打交道

#sys 和python解释器相关

#random 随机模块

#################################collections模块#############################

#模块就是一个.py文件

#nameturple

#列表

#字典

# #集合frozenset

# 字符串

#堆栈:先进后出原则

#队列:FIFO

#双端队列:

'''

namedtuple

'''

# from collections import  namedtuple

# Point = namedtuple('point',['x','y','z'])  #第一个参数是

# p=Point(1,2,3)

# print(p.x)

# print(p.y)

# print(p.z)

#

# Card  = namedtuple('card',['suits','num'])

# card = Card('红桃',2)

# print(card.suits)

#

# '''

# deque双端队列

#

# '''

#

# import  queue

# q = queue.Queue()

# q.put(10)

# q.put(5)

#

# q.put(6)

# print(q) #只有一个内村地址,盖着布的黑盒子

# print(q.qsize())

# # print(q.get())

# # print(q.get())

# # print(q.get())

# #print(q.get())  #如果没有值,就一直停在这,阻塞等待放出值

#

# for i in range(q.qsize()):

#    print(q.get())

# from collections import deque

#

# # deque.append()#从后面放数据

# # deque.appendleft()#前面方

# # deque.pop()#后面取数据

# # deque.popleft()#前面取数据

#

# #

# dq = deque([1,2])

# dq.append(89621)

# dq.appendleft('sdfds')

# print(dq.pop())

# dq.insert(0,'eeeee')

# print(dq.popleft())

# print(dq)

# #从前后插入数据,从前后输出数据,插入元素

# print(dq.__sizeof__())

#

#  #有序字典

# from collections import  OrderedDict

# od = OrderedDict([('a',1),('b',2),('c',3)])

# print(od)

# print(od['a'])

# for k in od:

#    print(k,od[k])

#默认字典

# from collections import defaultdict

#

# dic = defaultdict(lambda :5)

# print(dic['k'])

#

# import time

# # time.time()#返回以秒计算的时间

# # time.sleep()

#

# #表示时间的三种方式

# #时间戳  给计算机看的

# #格式化的时间  给人看的

# #结构化时间  --  元组:计算用的

# # 时间戳时间

# #############时间戳时间

#

#

# ############格式化时间

# # print(time.strftime('%Y/%m/%d %a %H:%M:%S'))

# # print(time.strftime('%m-%d'))

# #

# #

# # #  结构化时间

# #

# #

# # struct_time = time.localtime()

# # print(struct_time.tm_mday)

# #

# #

# # #时间戳————》结构化时间

# #

# # t = time.time()

# # print(t)

# # print(time.localtime(0))

# # print(time.gmtime(t))

# # print(time.mktime(time.localtime()))

#

#

#

# #

# # print(time.strftime('%m/%d/%y %H:%M:%S'))

# # print(time.asctime())

# #

# #

# #

# # t = time.time()

# # print(time.st)

#

# #############################random

#

#

# # import random

# #

# # print(random.random())

# # print(random.choice([1,2,3]))

# # print(random.randint(5,8))

# #

# # #########################

# # lis =[4142,32,23,22,32,23,23,2,2,3]

# # random.shuffle(lis)

# # print(lis)

#

#

#

# import random

# li =  []

# l = []

# def num_str(num):

#    return chr(num)

# for i in range(65,91):

#    li.append(num_str(i))

#

#

# for i in range(26):

#    li.append(li[i].lower())

#

# for i in range(10):

#    li.append(i)

#

# random.shuffle(li)

# for i in range(6):

#    l.append(str(li[i]))

#

#

# print(l)

# import os

# # print(os.getcwd()) #输出现在在的工作目录

# # os.chdir()#//改变工作目录

# # print(os.curdir)#返回当前目录.

# # print(os.pardir)#获取当前目录的父目录..

# # os.makedirs('模块/')#生成多级层递目录

# # os.removedirs("模块/")#目录唯恐删除,父目录也空删,层级删除

# #

# # os.mkdir()#生成单机目录

# # os.rmdir()#删除单及目录

# # os.listdir()#列出指定目录下的所有 文件

# #

# # os.sep()  #输出操作系统特定的路径分隔符

# # os.system("bash command")#运行shell命令,直接显示

# # os.popen("bash command").read()#运行shell命令,获取执行结果

# # os.environ()  #获取环境变量

# # print(os.path.split(os.getcwd()))

# # print(os.path.join("c",'user','local'))#路径的拼接

# # print(os.path.getsize(os.path.join()))

# #

#

#

import sys

#sys.exit()#程序退出

# print(sys.platform)

# print(sys.version)

# print(sys.path)

print(sys.argv)

相关文章

网友评论

      本文标题:2019-03-18

      本文链接:https://www.haomeiwen.com/subject/fqtvmqtx.html