i made a code that generate a file like this
import sys
file = open('output.txt','w')
x = [1,2,3,4,5,6,7,8,9,10]
f = [i**2 for i in x]
g = [i**3/100 for i in x]
strlist = list(map(str,f))
strlist1 = list(map(str,g))
file.write(','.join(strlist))
file.write('\n')
file.write('.'.join(strlist1))
and result is (file content)
1,4,9,16,25,36,49,64,81,100
0.01.0.08.0.27.0.64.1.25.2.16.3.43.5.12.7.29.10.0
and i want to read this file as integer to make a list like this
[1,4,9,16,25,36,49,64,81,100]
[0.01.0.08.0.27.0.64.1.25.2.16.3.43.5.12.7.29.10.0]
i got this error when i tried
with open('output.txt','r') as a:
data = a.readlines()[0]
with open('output.txt','r') as a:
data1 = a.readlines()[1]
intlist = []
intlist.append(data)
['1,4,9,16,25,36,49,64,81,100\n']
['0.01.0.08.0.27.0.64.1.25.2.16.3.43.5.12.7.29.10.0']
how can i fix it?