[Tutor] How to extract data from text to excel?
tee chwee liong
tcl76 at hotmail.com
Fri Mar 4 02:08:08 CET 2011
thanks Steven, i get what you mean now. final code works:
import xlwt
"""Reads robert.txt"""
# Create workbook and worksheet
wbk = xlwt.Workbook()
sheet = wbk.add_sheet('python')
row = 0 # row counter
f = open('robert.txt')
L = line.strip()
for c in L:
sheet.write(row,0,c)
row += 1
wbk.save('reformatted.data.xls')
thanks
tcl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110304/1ecaa5d9/attachment.html>
More information about the Tutor
mailing list