擅长:python、mysql、java
<p>经过今天(2014-2-18)的调查,我看不到使用<strong>xlwt</strong>读取XLS文件的方法。你只能用新鲜的东西写字。我认为最好使用<code>openpyxl</code>。下面是一个简单的例子:</p>
<pre><code>from openpyxl import Workbook, load_workbook
wb = Workbook()
ws = wb.create_sheet()
ws.title = 'Pi'
ws.cell('F5').value = 3.14156265
wb.save(filename=r'C:\book2.xls')
# Re-opening the file:
wb_re_read = load_workbook(filename=r'C:\book2.xls')
sheet = wb_re_read.get_sheet_by_name('Pi')
print sheet.cell('F5').value
</code></pre>
<p>请参阅此处的其他示例:<a href="http://pythonhosted.org/openpyxl/usage.html" rel="nofollow">http://pythonhosted.org/openpyxl/usage.html</a>(从中获取此修改的示例)</p>