Advertisement
Bleckpan

Xlwt

Jul 31st, 2011
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. import xlwt, xlrd, string
  2.  
  3. File = open('filepath', 'r')
  4. print File
  5. wb = xlwt.Workbook()
  6. ws = wb.add_sheet("Prices")
  7. XlsRow = 0
  8. XlsCol = 0
  9. for line in File:
  10.     line = string.lstrip(line)
  11.     line = string.split(line, ",")[0]
  12.     if string.find(line, 'Bat of'):
  13.         XlsCol = 0
  14.         #write(r, c, label="", style=Style.default_style)
  15.         ws.write(XlsRow, XlsCol, line)
  16.         XlsRow += 1
  17.     else:
  18.         XlsCol += 1
  19.         ws.write(XlsRow, XlsCol, line)
  20. #    print line
  21.        
  22. File.close()
  23. wb.save('Prices.xls')
  24. print "All Done."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement