Hey I want to arrange a text file using python. My python code is working perfectly but it's not give me expected answer. Let me explain I have a text file same like this:-
serial
name
phone
gmail
1
blah blah
55555
blah@blah.com
I wrote my script like this :-
out=open('out.txt','w')
with open('blah.txt') as b:
i=1
for line in b:
if i==1:
out.write(line)
i=i+1
elif type(line)==int:
out.write('\n'+line)
elif type(line)==str:
out.write('\b\t'+line)
else:
pass
out.close()
I didn't wrote entire program but it's like this. But it's give me my output same as my input. Am I missing something?
My expected Ans is:-
serial name phone gmail 1 blah blah 55555 blah@blah.com