[Solved] Tell me how to replace python data, How can I read the a.txt file and make it in the following format? [closed]


file = open('a.txt', 'r')

l = []
for line in file:
    l.append( line.split())

Then if you want the second part to be integer, you can use list comprehension:

l = [ [i[0], int(float(i[1]))] for i in l]

output

[['abcd.com', 0], 
['*', 66999306], 
['asdf.com', 150744025], 
['asfd.df.com', 193139033], 
['fdsa.com', 907938122], 
['bank.com', 2638989462], 
['fire.com', 4151822166],
['ms.com', 7026079907] ]

12

solved Tell me how to replace python data, How can I read the a.txt file and make it in the following format? [closed]