我对这个主题进行了大量研究,但问题是无法弄清楚如何使用 python3 发送多线程发布请求
names = ["dfg","dddfg","qwed"]
for name in names :
res = requests.post(url,data=name)
res.text
Run Code Online (Sandbox Code Playgroud)
在这里,我想发送所有这些名称,并且我想使用多线程来使其更快。
multithreading python-multithreading python-3.x python-requests
我有一个文件,其中数据的格式如下
abc@email.com:name
ewdfgwed@gmail.com:nameother
wertgtr@gmsi.com:onemorename
Run Code Online (Sandbox Code Playgroud)
我想将电子邮件和姓名存储在数组中,例如
email = ["abc@email.com","ewdfgwed@gmail.com","wertgtr@gmsi.com"]
names = ["name","nameother","onemorename"]
另外,伙计们,文件有点大,大约 50 MB,所以我也想在不使用大量资源的情况下完成
我已经尝试过这个工作,但无法完成任务
// read contents of the file
const data = fs.readFileSync('file.txt', 'UTF-8');
// split the contents by new line
const lines = data.split(/\r?\n/);
// print all lines
lines.forEach((line) => {
names[num] = line;
num++
});
} catch (err) {
console.error(err);
}
Run Code Online (Sandbox Code Playgroud)