zoukankan      html  css  js  c++  java
  • 对烈烈

    命名元组:namedtuple

    from collections import namedtuple
    # t=namedtuple('环节',['a','b','c'])
    # t1=t(1,2,3)
    # print(t1,1)
    # t=namedtuple('time_tuple',['','',''])
    # t1=t(11,1,13)
    # print(t1)
    # print(t1.年)

    Counter 计数

    from collections import Counter
    # s='qwer'
    # c=Counter(s)
    # print(c)
    s='qwer'
    dic={}
    for i in s:
        dic[i]=dic.get(i,0)+1
    print(dic)n

    from collections import deque(双向队列)

    队列:FIFO 先进先出

    栈:LIFO 后进先出 

    import queue
    q=queue.Queue()
    q.put('你好')
    q.put('世界')
    q.put('水电费')
    q.put('手动阀')
    q.put('应用')

    import shelve:省去很多代码去改字典

    import shelve
    f=shelve.open('ss')   创建了文件
    f['name']='alex'      字典的增加,字典的键必须是字符串
    print(f['name'])      字典的查看
    f['age']=999
    print(f.get('age'))

    shutil:高级文件模块

    shutil.copytile(原文件,要拷到哪里)  拷文件

  • 相关阅读:
    准确率99.9%的离线IP地址定位库
    手写一个消息队列以及延迟消息队列
    rabbitmq介绍
    污点和亲和力高级调度方式
    ceph
    Vue作业
    label和labelSeletor
    http状态简记
    数据库
    作业
  • 原文地址:https://www.cnblogs.com/weize111/p/10289874.html
Copyright © 2011-2022 走看看