随笔分类 - python
摘要:一切问题都可以用递归来解释。 python解决an问题。 def compute(a,n): if n == 0: return 1 if n < 0: return 1/a*compute(a,n+1) elif n > 0: return a*compute(a,n-1) Python解决列表排
阅读全文
摘要:处理签文件 代码 lines = [] with open('id.txt', 'r') as f_in: for line in f_in: line = line[0:-1] + ':' + '\n' lines.append(line) with open('id_.txt', 'w') as
阅读全文
摘要:处理前文件内容 代码 # 读取代码 fr = open('three.txt', 'r') dic = {} keys = [] # 用来存储读取的顺序 for line in fr: v = line.strip().split(':') dic[v[0]] = v[1] keys.append(
阅读全文
摘要:处理前 代码 ids = [] with open('id.txt') as file: # print(len(file.readlines())) for i in file.readlines(): ids.append(i[12:].split()) def text_save(filena
阅读全文
摘要:环境python3.6 合并前第一个文件和第二个文件 代码 file1 = open("my.txt","r") file2 = open("ids.txt","r") file1_lists =file1.readlines() file2_lists =file2.readlines() fil
阅读全文
摘要:python环境3.6 安装PyMouse和pyautogui(安装过程百度) PyMouse安装 一.使用外部库PyMouse,使用pip可以直接下载 pip install pymouse (安装pymouse必须要xlib的支持) pip install python-xlib pip ins
阅读全文
摘要:import re # 下方引号内添加替换掉请求头内容 headers_str = """ Accept: application/json, text/javascript, */*; q=0.01 Accept-Encoding: gzip, deflate, br Accept-Languag
阅读全文
浙公网安备 33010602011771号