Reputation: 29
I am trying to print the primary catchall but every time I do it it returns one character per line, how do I make it so it prints the whole catchall in one line.
Result:
@
g
m
a
i
l
.
c
o
m
Expected result: @gmail.com
JSON Code:
{
"primaryCatchall": "@gmail.com",
"secondaryCatchall": "@gmail.com",
"password": "password123",
"repeat": 5
}
Python code:
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)
Upvotes: 0
Views: 745
Reputation: 588
In your code, you loaded your JSON as the variable PrimaryCatchall. Right afterward, you ran a for loop for PrimaryCatchall, which got each individual character. Get rid of that for loop to fix the problem
Upvotes: 2