[list=1] [*]import math #def calcDistance(x1, x2, y1, y2, z1, z2): # distance = math.sqrt((x1 - x2)**2 + (y1 - y2)**2 + (z1 - z2)**2) # return distance output_file = open('output.txt', 'w') nums = [] nums.append(open('input.txt', 'r')) lines_of_file = [] for lines in nums: lines_of_file.append(lines.readlines()) print(lines_of_file) [/list]print returns: [['1 2 3 4 5 6\n', '7 8 9 0 1 2\n', '9 8 7 1 2 3\n', '11 12 13 14 15 16\n', '99 99 99 99 99 99\n', '\n']]
This is the correct numbers from the sample file he provided, however it should probably be [['1, 2, 3, 4, 5, 6], [etc, etc]] in order to work with it further
How can I split the contents of each string? When I use the split function it returns an error:
AttributeError: 'list' object has no attribute 'str'