You'll want something simple that can output to a excel file.
You'll want to split your line into separate lines and only extract the parts that you want. In your case the .split()
method would be very helpful. .split()
takes your string and splits it based on the delimiter given (default is space). For example string.split('\n')
will split the string by lines.
Something like this should be what you want:
import xlwt
book = xlwt.Workbook(encoding="utf-8")
sheet1 = book.add_sheet("Sheet 1")
temp[0].split('\n')
i = 0
for dataLine in temp[0]:
sheet1.write(i, 0, dataLine.split()[0])
i += 1
book.save("excel.xls")
Note: If you do not want the Neighbors heading you can skip that line and start i
at 1.