遍历多个 txt 文件进行获取值
2024-10-09 11:02:31
import random def load_config(path):
with open(path,'r') as tou:
return [line for line in tou.readlines()] headers = {
'User-Agent':load_config('useragents.txt')[random.randint(,len(load_config('useragents.txt'))-)].strip("\n"),
'Referer':load_config('referers.txt')[random.randint(,len(load_config('referers.txt'))-)].strip("\n"),
'Accept':load_config('acceptall.txt')[random.randint(,len(load_config('acceptall.txt'))-)].strip("\n"),
}
print(headers)
2020-04-25 00:52:04
最新文章
- C#中实现并发的几种方法的性能测试
- WCF学习之旅—WCF服务的WAS寄宿(十二)
- 递归 CTE
- Asp.Net MVC<;六>;:Controller、Action 待续
- 负载均衡、LVS概述
- MySQL的多实例
- KingPaper初探 wamp下本地虚拟主机的搭建
- C/C++ 对优先级与结合性的理解
- hibernate 反向生成 实体类
- EBS DBA指南笔记(二)
- WPF RadioButton的绑定
- Kong(V1.0.2)loadbalancing
- Android-Java多线程通讯(生产者 消费者)&;10条线程对-等待唤醒/机制的管理
- jboos下载地址记录
- python 复制/移动文件
- android拾遗——Android之Service与IntentService的比较
- C#,数据类型扩展 z
- img-图片二进制流 64位前端显示
- 国际时区 TimeZone ID列表
- Ant Design 通过 WeekPicker 获取一周的起止时间