zoukankan      html  css  js  c++  java
  • python常用方法

     1 #python3.9.1
     2 # #1.逐行读取文件返回list
     3 # def getList(dir,fileNm):
     4 #     list = []
     5 #     fl = open(dir+"\"+fileNm)
     6 #     line = fl.readline()
     7 #     while line:
     8 #         line = line.strip('
    ')
     9 #         list.append(line)
    10 #         line = fl.readline()
    11 #     fl.close()
    12 #     return list
    13 
    14 # #2.python操作excel
    15 # import openpyxl
    16 # workdir = r""
    17 # filenm = ""
    18 # wb = openpyxl.load_workbook(filenm=workdir+"\"+filenm)
    19 # sh = wb['']
    20 # cell_value = sh[''].value
    21 
    22 # #3.list比较
    23 # #list2没有
    24 # result1 = set(list1).difference(set(list2))
    25 # #list1没有
    26 # result2 = set(list2).difference(set(list1))
    27 
    28 ##4.写入文件
    29 # with open(workDir+"\"+f,'w') as file_object:
    30 #     file_object.write(content+"
    ")
    31 
    32 # #5.list去重,会改变顺序
    33 # list(set(lists))
    34 
    35 # #6.list去重,不改变顺序
    36 # def distinctList(list1):
    37 #     list2 = []
    38 #     for i in list1:
    39 #         if i not in list2:
    40 #             list2.append(i)
    41 #     return list2
  • 相关阅读:
    ios录音
    ios 音乐播放
    ios程序播放音频文件
    ios摇一摇截屏代码
    加速计
    蓝牙4.0实现及原理
    物理仿真
    iOS 监听耳机变化
    删除缓存
    宏定义加参数
  • 原文地址:https://www.cnblogs.com/yanweichen/p/14197122.html
Copyright © 2011-2022 走看看