我试图打印主catchall,但每次打印时,它每行返回一个字符,如何使它在一行中打印整个catchall
结果:
@
g
m
a
i
l
.
c
o
m
预期结果:@gmail.com
JSON代码:
{
"primaryCatchall": "@gmail.com",
"secondaryCatchall": "@gmail.com",
"password": "password123",
"repeat": 5
}
Python代码:
import json
with open('tempemail.txt', 'r') as myfile1:
email1 = myfile1.read()
with open('config.json', 'r') as config:
PrimaryCatchall = json.load(config)
for primaryCatchall in PrimaryCatchall['primaryCatchall']:
with open('accounts.txt', 'a') as accounts:
print(primaryCatchall)
#accounts.write("\n")
#accounts.write(email1)
#accounts.write(primaryCatchall)
在代码中,您将JSON作为变量PrimaryCatchall加载。紧接着,您为PrimaryCatchall运行了一个for循环,它得到了每个单独的角色。摆脱for循环来解决问题
相关问题 更多 >
编程相关推荐