I'm working on a python script that I will get all inactive users and list it on a txt file. I have append it on a txt.file however it seems "\n" does not give me proper results that I need.
This is my code.
with open('InactiveUsersList', 'w') as f:
inactiveUser = (str(userDetail.get("firstName")) + " " + str(userDetail.get("lastName")) +": User is not Active")
print(inactiveUser)
print("----------------------------------")
for i in inactiveUser:
f.write(i + '\n')
f.close()
The output that I'm expecting should be like this:
LastName FirstName: User is not Active
LastName2 FirstName2: User is not Active
But instead, I'm having this result.
L
a
s
t
N
a
m
e
F
i
r
s
t
N
a
m
e
:
U
s
e
r
i
s
n
o
t
A
c
t
i
v
e
Thanks for your help everyone :)