[Pythonmac-SIG] inputing multi-digit numbers

Dethe Elza delza at livingcode.org
Thu Nov 10 19:05:39 CET 2005


On 10-Nov-05, at 5:01 AM, <Henning.Ramm at mediapro-gmbh.de>  
<Henning.Ramm at mediapro-gmbh.de> wrote:

>
> -----Original Message-----
> From: pythonmac-sig-bounces at python.org [mailto:pythonmac-sig- 
> bounces at python.org] On Behalf Of Kirk Durston
> Sent: Thursday, November 10, 2005 2:00 AM
> To: pythonmac-sig at python.org
> Subject: [Pythonmac-SIG] inputing multi-digit numbers
>
> I’m having a hard time figuring out how to input a list of numbers,  
> each one of which can be 1, 2, or 3 digits in length. First, I  
> select a column in an Excel file, and copy and past it into a Word  
> file. I then save it as a text file.

Wouldn't it be simpler to use Excel to export as CSV and use python's  
csv module to read them in?

http://python.org/doc/current/lib/module-csv.html

I don't understand why Word is involved in getting numbers from Excel  
to Python.

Another alternative would be to use the excellent pywin32 tools to  
extract Excel data directly from within Python, using Excel's COM  
interface.

http://sourceforge.net/projects/pywin32/

Excel has other interfaces it exposes besides COM.  Here is a recipe  
from the Python Cookbook to extract tabular data from an Excel file  
using pywin32 and the ADODB interface.

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440661

I hope this is helpful.

--Dethe

"the city carries such a cargo of pathos and longing
  that daily life there vaccinates us against revelation"
  -- Pain Not Bread, The Rise and Fall of Human Breath



More information about the Pythonmac-SIG mailing list