how to get the output in the same line python
我试图发送一个"骗子"一堆伪造的电子邮件和密码,但我得到了这个输出:
1 2 | Milan 91@protonmail.com |
这是脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import requests import random val = 1 url = 'https://repens.serveo.net/login.php' while val == 1: file = open("/home/user/Documents/scam/names.json").readlines() random_name = random.choice(file) random_number = random.randint(0, 99) email_provider = ["@yahoo.com","@gmail.com","@walla.com"] random_email_provider = random.choice(email_provider) name = random_name username ="%s%s%s" % (name, random_number, random_email_provider) password = random.randint(0, 9999999) print(username) requests.post(url, allow_redirects=False, data={ 'username': username, 'password': password }) |
这就是我的名字文件的样子:
利亚姆诺亚威廉詹姆斯洛根
我也尝试过:
["利亚姆""诺亚""威廉""杰姆斯""洛根"]
要在一行中附加3个字符串,需要获取不带下一行字符的名称。您正在从由
1 | names = list(map(file.read().split())) |
您也可以这样做,从文件中获取您的姓名:
1 2 3 | with open('data.txt', 'r') as myfile: data=myfile.read().replace(' ', '') |
引用:如何将文本文件读取到字符串变量中?