"Kirk Bailey" <[EMAIL PROTECTED]> wrote
> Ii want to read a xls file and use the data in part of it. What
> module
> would help make sense of one?
If the data is straighforward you might find it easier to save it as a
csv file first.
But otherwise there is a module called pyexcelerator (I th
I asked:
> Is it possible to convert a Python package, with __init__.py and
> related python modules, into a single DLL or shared library that can
> be imported in the same way?
>
> We have used py2exe and cx_freeze to create a complete executable,
> but we are curious whether there is a middle wa
Alan Gauld <[EMAIL PROTECTED]> wrote:
"Kirk Bailey" wrote
> Ii want to read a xls file and use the data in part of it. What
> module
> would help make sense of one?
If the data is straighforward you might find it easier to save it as a
csv file first.
But otherwise there is a module calle
Sorry, I just started experimenting on Python classes...
Is there any way a reference to a class attribute ([class].[attribute]) be
treated like a method ([class].[method]())?
I have a class with DB component. Some of its attributes are derived from DB
and I find it impractical to derive all at o
Is there a comprehensive list of dictionary KeyError meanings?
I could sure use one these days and haven't had much luck tracking one down yet.
-Rob
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
At 04:38 PM 8/14/2007, Fiyawerx wrote:
My company has a subscription
with the books24x7.com site, and I'm
sure they offer individual accounts, but so far I'm ashamed that I've
paid close to 200$ worth of computer books that I could have been
accessing online for free. Including 'dummies' books, T
> Is there any way a reference to a class attribute ([class].[attribute]) be
> treated like a method ([class].[method]())?
> :
> Of course we can use dictionary-like syntax ([class]["[attribute]"]) and use
> __getitem__, checking for existence and None of the attribute before
> deriving the
> Is there a comprehensive list of dictionary KeyError meanings?
>
> I could sure use one these days and haven't had much luck tracking one down
> yet.
can you give us an example of what you're looking for? generally:
exception KeyError:
Raised when a mapping (dictionary) key is not found in t
Alan Gauld wrote:
> "Tonu Mikk" <[EMAIL PROTECTED]> wrote
>
>
>> I create more robots in this way which seems to work:
>> class Robot:
>>pass
>>
>
> By using an empty class you are losing m,uch of the power of classes.
>
>
I would need to learn more to handle the classes better. I
Vincent Gulinao wrote:
> Sorry, I just started experimenting on Python classes...
>
> Is there any way a reference to a class attribute ([class].[attribute])
> be treated like a method ([class].[method]())?
>
> I have a class with DB component. Some of its attributes are derived
> from DB and I
Rob Andrews wrote:
> Is there a comprehensive list of dictionary KeyError meanings?
?? AFAIK there is only one meaning for KeyError - the key was not found
in the dict. From the docs: "Raised when a mapping (dictionary) key is
not found in the set of existing keys."
Kent
___
Hello list,
thanks to everybody who shared their experience with books and their
usefulness.
I think with regard to the other thread that passed lately:
Books with exercises and problems to solve -
http://article.gmane.org/gmane.comp.python.tutor/42394
we must admit there are two type of learn
"Duncan Gibson" <[EMAIL PROTECTED]> wrote
> Alan also suggested:
> A> So if its accessibility to non Python code you are interested
> A> in grab a copy of Mark Hammonds Win32 book for details
Actually I meant to say
So if its accessibiity *from* non python code
But since that doesn't appear
"Rob Andrews" <[EMAIL PROTECTED]> wrote
> Is there a comprehensive list of dictionary KeyError meanings?
I don't understand the question Rob.
A KeyError means the key used wasn't found in the dictionary
What other meanings are you thinking of?
Alan G.
Vincent Gulinao wrote:
>
>
> Sorry, I just started experimenting on Python classes...
>
> Is there any way a reference to a class attribute ([class].[attribute])
> be treated like a method ([class].[method]())?
>
> I have a class with DB component. Some of its attributes are derived
> from DB
Sorry about that. I want something like:
class foo:
def __init__(self):
self.attr1 = None
def get_attr1(self):
if not self.attr1:
attr1 =
self.attr1 = attr1
return self.attr1
such that:
foo_instance = foo()
then:
foo_insta
"Vincent Gulinao" <[EMAIL PROTECTED]> wrote
> Is there any way a reference to a class attribute
> ([class].[attribute]) be
> treated like a method ([class].[method]())?
Yes, classes are just objects and their attributes are too.
class Test: pass
def f(self): print 'howdy!'
Test.foo = f
t = T
Vincent Gulinao wrote:
>
> Sorry, I just started experimenting on Python classes...
>
> Is there any way a reference to a class attribute
> ([class].[attribute]) be treated like a method ([class].[method]())?
>
Attributes are objects. A method is an object. If you want to know
something more spec
Rob Andrews wrote:
> Is there a comprehensive list of dictionary KeyError meanings?
>
>>> d = {1:2}
>>> d[1]
2
>>> d[2]
KeyError
AFAIK that's it.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hello All,
I am new to computer programming and chose to learn
Python. Now I am stuck with certain codes that I need
help. Please let me know if there is an answer list
to the exercises in "How to Think Like a Computer
Scientist: Learning with Python."
I followed and did good on most of the exe
Hi everyone -
I'm beginning to learn how to program in python. I need to process several
text files simultaneously. The program needs to open several files (like a
corpus) and output the total number of words. I can do that with just one file
but not the whole directory. I tried glob but it d
Paulo Quaglio wrote:
> Hi everyone -
> I'm beginning to learn how to program in python. I need to process
> several text files simultaneously. The program needs to open several
> files (like a corpus) and output the total number of words. I can do
> that with just one file but not the whole dire
Really? What are you having trouble with? I have used pyexcelerator
under Windows without problems.
--
John.
On 16/08/07, Kirk Bailey <[EMAIL PROTECTED]> wrote:
> looks good. works bad; this is a windows workplace. ouch. Advice please
> (other than change operating systems)?
>
> John Fouhy wro
Vincent Gulinao wrote:
> Sorry about that. I want something like:
>
> class foo:
>
> def __init__(self):
>
> self.attr1 = None
>
>
> def get_attr1(self):
>
> if not self.attr1:
>
> attr1 =
>
> self.attr1 = attr1
>
> return self.
Greetings,
I think the accepted way to get help on this list
is to post the code you're having problems with,
showing what you've done, the error messages
you're getting, and an explanation of what you're
trying to do, the input, output expected, and so
forth. It is helpful for the Tutors to also
I don't know of any answer list but one you can ask for help here or what I
do when I have a question i stop working on it for anywhere from an hour to
a week and go back to it you will solve it if you solve it in your sleep
well thats a whole other issue but that does happen.
-Amadeo
On 8/15/07,
bob gailer wrote:
> Vincent Gulinao wrote:
>> Sorry, I just started experimenting on Python classes...
>>
>> Is there any way a reference to a class attribute
>> ([class].[attribute]) be treated like a method ([class].[method]())?
>>
> Attributes are objects. A method is an object. If you want to
I don't know of an answer key, but feel free to post questions about
what you're having trouble with and we'd be happy to discuss various
approaches among the list members.
Vanneth Tea wrote:
> Hello All,
>
> I am new to computer programming and chose to learn
> Python. Now I am stuck with cer
Vanneth Tea wrote:
> Hello All,
>
> I am new to computer programming and chose to learn
> Python. Now I am stuck with certain codes that I need
> help.
Where are you stuck? We should be able to help you here if you can be
more specific.
It helps us to help you if you can show us
- the code yo
We've all been there.
But what exactly is the problem you're having? Its really hard to know what
sort of help you require if you didn't tell us what the problem is.
Please help us to help you!
Ciao
- Original Message -
From: "Vanneth Tea" <[EMAIL PROTECTED]>
To:
Sent: Wednesday, A
If a line in a script has
n = "1,987,087,234,456"
It's simple to convert the string, "1,987,087,234,456" to an int, but
I can't figure out how to do it for
n = 1,987,087,234,456 # no quotes
(I want to be able to type in big ints using commas--much easier to
see that I've typed correctly)
Python
On Wed, Aug 15, 2007 at 08:26:45AM -0700, Paulo Quaglio wrote:
> Hi everyone -
> I'm beginning to learn how to program in python. I need to
> process several text files simultaneously. The program needs to
> open several files (like a corpus) and output the total number
> of words. I can
> Sorry about that. I want something like:
>
> class foo:
>
>def __init__(self):
>
> self.attr1 = None
>
>
>def get_attr1(self):
>
> if not self.attr1:
>
> attr1 =
>
> self.attr1 = attr1
>
> return self.attr1
>
>
> such that:
>
> foo_instanc
"Vincent Gulinao" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Sorry about that. I want something like:
>
> class foo:
>
>def __init__(self):
> self.attr1 = None
>def get_attr1(self):
> if not self.attr1:
> attr1 =
> self.attr1 = a
"Vanneth Tea" <[EMAIL PROTECTED]> wrote
> have been stuck on a few of them which burned me up
> after spending days and nights trying ...
> I hope you understand the feeling when you are stuck
Yep we all understand and sympathise. But before
we can help you we need some more information.
Like
Vanneth Tea wrote:
> Hello All,
>
> I am new to computer programming and chose to learn
> Python. Now I am stuck with certain codes that I need
> help. Please let me know if there is an answer list
> to the exercises in "How to Think Like a Computer
> Scientist: Learning with Python."
>
> I follo
Forwarding to list for completeness
- Forwarded Message
From: Rob Andrews <[EMAIL PROTECTED]>
To: Alan Gauld <[EMAIL PROTECTED]>
Sent: Wednesday, 15 August, 2007 10:32:30 PM
Subject: Re: [Tutor] KeyError list?
I guess I couldn't believe it was that simple. ;-)
Sorry for the delayed, bri
> Hi everyone -
> I'm beginning to learn how to program in python. I need to process
> several text files simultaneously. The program needs to open several files
> (like a corpus) and output the total number of words. I can do that with
> just one file but not the whole directory. I tried glob
"Paulo Quaglio" <[EMAIL PROTECTED]> wrote
> I'm beginning to learn how to program in python.
> I need to process several text files simultaneously.
Do you really mean simultaneously or just all in the same
execution of the program? ie The one program run opens
each file in sequence and rep
Hello there
Messing around with certain time and datetime objects, I have managed to
subtract a date/time from the present time thusly:
from time import *
import datetime
one = datetime.datetime.now()
two = datetime.datetime(2007, 8, 29, 11, 15, 00)
difference = one - two
print difference
H
Alan Gauld wrote:
> "Vincent Gulinao" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Sorry about that. I want something like:
>>
>> class foo:
>>
>>def __init__(self):
>> self.attr1 = None
>>def get_attr1(self):
>> if not self.attr1:
>> attr1 =
Tiger12506 wrote:
> It's a little ugly but not too bad. What you are describing are properties.
>
> class Foo:
should be
class Foo(object):
> def _get_attr1(self):
> if not self.attr1:
> attr1 = TheValue
> return attr1
You have to use a different name for the actual data att
On 16/08/07, Dick Moores <[EMAIL PROTECTED]> wrote:
> Python sees 1,987,077,234,456 as a tuple:
> >>>type(1,987,077,234,456)
>
Hmm, not for me:
>>> type(1,987,077,234,456)
Traceback (most recent call last):
File "", line 1, in
TypeError: type() takes 1 or 3 arguments
What python are you usi
At 06:58 PM 8/15/2007, John Fouhy wrote:
>On 16/08/07, Dick Moores <[EMAIL PROTECTED]> wrote:
> > Python sees 1,987,077,234,456 as a tuple:
> > >>>type(1,987,077,234,456)
> >
>
>Hmm, not for me:
>
> >>> type(1,987,077,234,456)
>Traceback (most recent call last):
> File "", line 1, in
>TypeErro
> I guess I couldn't believe it was that simple. ;-)
now if you had asked about the meanings of *all* exceptions (including
warnings), or perhaps all the SMTP exceptions in smtplib, that would
another matter. ;-)
cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core
[EMAIL PROTECTED] wrote:
> Hello there
>
> Messing around with certain time and datetime objects, I have managed to
> subtract a date/time from the present time thusly:
>
datetime is definitely a module that takes a little getting used to.
> from time import *
>
(Bad form)
> import datet
On 16/08/07, Dick Moores <[EMAIL PROTECTED]> wrote:
> That's cool! However, it doesn't solve the problem in my original post.
>
> >>> t = 1,987,087,234,456
>File "", line 1
> t = 1,987,087,234,456
> ^
> SyntaxError: invalid token
Hmm, yes. Any integer starting with a 0
At my current day job, I'm handed a wild variety of data from
customers, and most of it hasn't been normalized in any reasonable
way. File formats are inconsistent, numbers of fields are randomly
inconsistent with the headers, etc.
Attempting to massage these into files I can process has involved
[EMAIL PROTECTED] wrote:
> Hello there
>
> Messing around with certain time and datetime objects, I have managed to
> subtract a date/time from the present time thusly:
>
> from time import *
> import datetime
>
> one = datetime.datetime.now()
> two = datetime.datetime(2007, 8, 29, 11, 15, 00)
At 06:58 PM 8/15/2007, John Fouhy wrote:
>You could do this:
>
> >>> def decomma(*t):
>... return int(''.join(str(i) for i in t))
What's that asterisk doing in decomma(*t)? Where do I go in the docs
to look it up?
Thanks,
Dick
___
Tutor maillist -
I am a newbie but think its for variable input. Allows you to enter any number
with commas in it and still work properly. Since it thinks the number is a
tuple, then depending on the number your tuple could vary in length.
Eric Walker
Dick Moores <[EMAIL PROTECTED]> wrote: At 06:58 PM 8/15/2007
At 06:58 PM 8/15/2007, John Fouhy wrote:
>What python are you using? (2.5.1 for me)
2.5. If I install 2.51 will it install itself "over" my 2.5? Or will
it set itself up in a separate Python 251 folder/directory?
Dick
___
Tutor maillist - Tutor@pyt
On 16/08/07, Dick Moores <[EMAIL PROTECTED]> wrote:
> What's that asterisk doing in decomma(*t)? Where do I go in the docs
> to look it up?
You can find it in the tutorial:
http://docs.python.org/tut/node6.html#SECTION00674
Or see my post here:
http://mail.python.org/pipermail/tut
Dick Moores wrote:
> At 06:58 PM 8/15/2007, John Fouhy wrote:
>
>> You could do this:
>>
>>
> def decomma(*t):
>
>> ... return int(''.join(str(i) for i in t))
>>
>
> What's that asterisk doing in decomma(*t)? Where do I go in the docs
> to look it up?
>
>
It's
To Eric Walker, John Fouhy, and Eric Brunson:
Thanks very much. I think I'm beginning to get it. At least I was
able to write a couple of functions that do what I wanted:
=
def f(n,m,*args):
x = n*m
for arg in args:
product = arg*x
x = product
At 05:48 PM 8/14/2007, Kent Johnson wrote:
>I also have a shortcut set up so if I type
>py modulename
>in the Firefox address bar it takes me directly to the docs for that
>module. To do this, create a bookmark with this URL:
>file://localhost/Users/kent/Library/Documentation/Python-Docs-2.5/li
56 matches
Mail list logo