I am new to Python, so please do not laugh at this question......
I have some arrays in a file, shown below
100 23 35 44 47 511
100 60 77 68 45 76
100 97 99 89 91 14
100 53 65
I have read the file and got every row with the following code,
f = file('new.txt')
lines = f.readlines()
f.close()
results = []
for line in lines:
print line
but in order to treat them as an input of a function, as below,
clf.fit ([[0, 0], [1, 1], [2, 2]], [0, 1, 2])
I think I need to format my arrays to make every array in the square brackets ([ ]) and add commas among them. The final format I need is like this
clf.fit ([[100,23,35,44,47,511], [100,60,77,68,45,76], [100,97,99,89,91,14]], [100,53,65])
How can achieve it?
resultsisn't used in the above example. Where doesclf1come from?