ubuntuusers.de

Unbenannt

Autor:
dAnjou
Datum:
8. Mai 2015 03:18
Code:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#!/usr/bin/env python
 
import sys
import codecs
 
# needed to be able to pipe output
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
 
from xlrd import open_workbook
 
book = open_workbook('test_data.xls')
sheet = book.sheet_by_index(0)
for row in range(sheet.nrows):
    line = [sheet.cell(row,col).value for col in range(4)]
    print " ".join(line)