Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Newbie: Reading and printing cells from excel
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
jrara  
View profile  
 More options Oct 28, 11:12 pm
From: jrara <johannesr...@gmail.com>
Date: Wed, 28 Oct 2009 05:12:53 -0700 (PDT)
Local: Wed, Oct 28 2009 11:12 pm
Subject: Newbie: Reading and printing cells from excel
Hi,

I'm python newbie but I'm trying to read data from Excel file (from
one column) and print it into the output. Here's my code:

------------- python code -----------
#!/Python26/
# -*- coding: utf-8 -*-

import xlrd
wb = xlrd.open_workbook('testiexcel.xls')

#Get the first sheet either by name
sh = wb.sheet_by_name(u'data')

sposti = sh.col_values(8)
for i in range(sh.nrows):
    print sposti(i) + ';'
------------- python code -----------

I get an error

Traceback (most recent call last):
  File "Read_xls_files.py", line 18, in <module>
    print sposti(rownum)
TypeError: 'list' object is not callable

What I'm doing wrong?


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Георги Георгиев  
View profile  
 More options Oct 28, 11:26 pm
From: Георги Георгиев <georgi_georg...@directservices.bg>
Date: Wed, 28 Oct 2009 14:26:25 +0200
Local: Wed, Oct 28 2009 11:26 pm
Subject: Re: [pyxl] Newbie: Reading and printing cells from excel
try

print sposti[i] + ';'

hope this helps :-)


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Machin  
View profile  
 More options Oct 28, 11:30 pm
From: John Machin <sjmac...@lexicon.net>
Date: Wed, 28 Oct 2009 23:30:24 +1100
Local: Wed, Oct 28 2009 11:30 pm
Subject: Re: [pyxl] Newbie: Reading and printing cells from excel
On 28/10/2009 11:12 PM, jrara wrote:

> Hi,

Hi jrara, welcome to the group.

There is no line "print sposti(rownum)" in the code listing. Please when
you are reporting an error, make sure that the code that you show is the
code that you ran.

> TypeError: 'list' object is not callable

> What I'm doing wrong?

Mixing up function/method calling e.g. do_something_with_this(thing) and
sequence subscripting e.g. a_sequence_like_sposti[index_expression] ...
The error message means that sposti refers to a list but you are trying
to call it like a function.

HTH,
John


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
johannes rara  
View profile  
 More options Oct 29, 12:08 am
From: johannes rara <johannesr...@gmail.com>
Date: Wed, 28 Oct 2009 15:08:04 +0200
Local: Thurs, Oct 29 2009 12:08 am
Subject: Re: [pyxl] Re: Newbie: Reading and printing cells from excel
Thanks, that solved the problem!

- Johannes

2009/10/28 Георги Георгиев <georgi_georg...@directservices.bg>:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google