with open('data.txt') as f:
polyShape = []
for line in f:
line = line.split() # to deal with blank
if line: # lines (ie skip them)
line = [int(i) for i in line]
polyShape.append(line)
会给你
[[0, 0, 3, 50], [50, 100, 4, 20]]
这将适用于包含(或不包含)空行的文件。