摘要: tools.py import os import json from subprocess import PIPE from subprocess import Popen from subprocess import STDOUT from ffmpy3 import FFmpeg from A 阅读全文
posted @ 2019-11-18 21:45 Ablert丶 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 打开文件的两种方式 1.直接打开文件并赋值给变量,打开后得到操作句柄,但不会自动关闭 file = open('文件名‘,'打开模式',’编码‘) fd = open('../config/file1.txt','r',encoding='utf-8') 2.使用with子句,打开后文件会自动关闭, 阅读全文
posted @ 2019-11-18 20:40 Ablert丶 阅读(170) 评论(0) 推荐(0) 编辑
摘要: StringIO 很多时候,数据读写不一定是文件,也可以在内存中读写。 StringIO顾名思义就是在内存中读写str。 要把str写入StringIO,我们需要先创建一个StringIO,然后,像文件一样写入即可: >>> from io import StringIO >>> f = Strin 阅读全文
posted @ 2019-11-18 20:31 Ablert丶 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 给unittest传值: class TesCase(unittest.TestCase): # k1 = expect = msg = None # requests的返回结果和用例的预期值 def runTest(self): self.assertEqual(self.k1, self.k2, 阅读全文
posted @ 2019-11-18 20:11 Ablert丶 阅读(76) 评论(0) 推荐(0) 编辑