📝 面试求职: 「面试试题小程序」 ,内容涵盖 测试基础、Linux操作系统、MySQL数据库、Web功能测试、接口测试、APPium移动端测试、Python知识、Selenium自动化测试相关、性能测试、性能测试、计算机网络知识、Jmeter、HR面试,命中率杠杠的。(大家刷起来…)
📝 职场经验干货:
cmd - 提供了一个简单的框架用于编写基于命令行的交互式命令解释器。
import cmd
class MyCmd(cmd.Cmd):
def do_greet(self, line):
print("Hello,", line)
def do_exit(self, line):
return True
MyCmd().cmdloop()
getpass - 用于获取密码而不回显到屏幕上,也支持获取用户名。
import getpass
user = getpass.getuser()
password = getpass.getpass()
print(f"Username: {user}")
glob - 根据指定的模式查找文件路径名,实现了类似于Unix shell的文件模式匹配。
import glob
files = glob.glob('*.txt') # 查找当前目录下的所有.txt文件
print(files)
pickle - 实现了对一个Python对象结构的序列化和反序列化。
import pickle
data = {'key': 'value'}
with open('data.pkl', 'wb') as f:
pickle.dump(data, f) # 序列化数据并保存到文件
shelve - 为pickle提供了简单的接口,允许将Python对象存储在类似字典的对象中,并持久化到文件。
import shelve
with shelve.open('mydata') as db:
db['key'] = 'value'
codecs - 提供了对文本编码和解码的支持。
import codecs
with codecs.open('file.txt', 'r', encoding='utf-8') as file:
content = file.read()
functools - 提供了高阶函数的支持,比如装饰器和偏函数应用。
from functools import lru_cache
@lru_cache(maxsize=None)
def fib(n):
if n < 2:
return n
return fib(n-1) + fib(n-2)
inspect - 提供了几种有用的函数来帮助你了解活动对象,如模块、类、方法等。
import inspect
def my_function():
pass
print(inspect.getsource(my_function)) # 获取函数源代码
weakref - 支持弱引用,有助于垃圾回收,避免循环引用问题。
import weakref
class MyClass:
pass
obj = MyClass()
r = weakref.ref(obj)
print(r()) # 输出弱引用指向的对象
xml.etree.ElementTree - 解析和创建XML数据。
import xml.etree.ElementTree as ET
tree = ET.parse('example.xml')
root = tree.getroot()
print(root.tag)
最后: 下方这份完整的软件测试视频教程已经整理上传完成,需要的朋友们可以自行领取【保证100%免费】