Hi all,
I'm just looking for a quick runthrough on the differences between new
style classes and the old ones, and how to use the new ones.
Also, how exactly do you use __slots__? I've got a 6000 object
collection, and apparently using __slots__ will save memory, but only
those attributes specifi
Negroup - wrote:
> Hi all, I have a question about the following lines of code:
>
>
class Foo:
>
> ... bar = 'bar'
> ...
>
# is it better this
def te(attribute):
>
> ... try:
> ... print getattr(c, attribute)
> ... except AttributeError:
> ... re
> I thought lists would be the best but I really don't know how to use
> them
They're easy. Just put stuff in square brackets with commas between.
mycoollist = [1,5,9,3,6,9,2,6]
mystringlist = ['a', 'u', 'e', 'b', 'd', 'h', 'q', 't']
Can you predict what this code will do?
print mycoollist[0]
Hi I'm playing with a Binary to text & text to binary converter. I can't
figure out how to replace the characters (first stage: text to binary).
I thought lists would be the best but I really don't know how to use
them... here's my code:
#! /usr/bin/env python
A = "0101"
B = "0110"
C = "
Hi all, I have a question about the following lines of code:
>>> class Foo:
... bar = 'bar'
...
>>> # is it better this
>>> def te(attribute):
... try:
... print getattr(c, attribute)
... except AttributeError:
... return None
>>> #
>>> # or this?
>>> def h_a(at
On Fri, 23 Sep 2005, Nathan Pinno wrote:
> I need help with pi and the math module. I had import math at the top of
> a program, but when it came to diameter*pi, it said that pi was not
> defined.
Hi Nathan,
Python's module import will not automatically pull all the names in a
module and dum
Hi all,
I need help with pi and the math module. I had import math at the top
of a program, but when it came to diameter*pi, it said that pi was not
defined.
How do I use it correctly?
Thanks,
Nathan Pinno
___
Tutor maillist - Tutor@python.or
Bob, Michael, my thanks to you both for answering my diamond operator
question.
Bob, I tried the lines you suggested and they worked just the way I wanted
them to. Thanks.
Michael, thanks for the user functions or subroutines: not sure what Python
calls them. A lot of food for thought there. M
On Fri, 23 Sep 2005, Valone, Toren W. wrote:
> I am trying to noodle thru classes with python and I built the following
> class.
Hi Toren,
Ah. Check your indentation: it appears that the definition of getday() is
within the body of the class initializer __init__().
What ends up happening is
On Fri, Sep 23, 2005, Valone, Toren W. wrote:
>I am trying to noodle thru classes with python and I built the following
>class
>
>import time
>
>class startremail:
>def __init__(self):
> remailfile = open('U:\Bounce20.txt', 'r') #future
>address/file from outlook
> resendf
I am trying to noodle thru classes with python and I built the following
class
import time
class startremail:
def __init__(self):
remailfile = open('U:\Bounce20.txt', 'r') #future
address/file from outlook
resendfile = open('resend.txt', 'w') #currentl
Hi grouchy,
I seem to have found the problem. Somehow, it seems BeautifulSoup
doesn't like nested tags of the same name. For instance, I had this
tree:
Printing the entire tree in the command line shell showed some weird
rear
On Thursday 22 September 2005 23:46, [EMAIL PROTECTED] wrote:
> I am coming to Python from Perl. Does Python have anything like the diamond
> operator found in Perl?
The correct answer is not really no, but you can manually perform the
same tasks. For those who don't know perl, <> is an incredibly
Hi Bernard,
Not much of an answer, but I printed out your snippet with prettify() to see how it was being parsed, and either the XML is funny, or Beautiful Soup is :)
>>> from BeautifulSoup import BeautifulStoneSoup as BSS >>> soup = BSS(xml)>>> print soup.prettify()
1 3
1.797693
Hey Hugo
Yes...I have PIL 1.1.5 installed.
The weird thing about this is that the program gets one image and then show
the error I sent
After that it doesn't load any more images and I have to unplug tha web cam
and plug it again so I can get the software to work only one more time and
so on
I
Hello,
I have this set of XML tags:
1
3
1.79769313486e+308
False
-1.79769313486e+308
7.64880829803
False
20
Ed Singleton wrote:
> My instinct was to try and write a small program similar to vim, but
> in Python. The very basics should be quite easy. If I start a system
> that is very easily expandable then as and when I need further
> functionality I can add it in.
I'd say it's better to either adapt
Ed,
Before you dive into a full-fledged editor development project you might
want to consider an existing extendible platform like Eclipse. It is much
more than just an editor, i.e. it is an advanced IDE platform. The sweet
thing is that it allows for developing plugins to add functionality.
At 04:37 AM 9/23/2005, [EMAIL PROTECTED] wrote:
>[snip]
>In perl I can write this:
>
>@array = <>;
>print @array;
>
>If I save that and call it from the command line, I can include the name of a
>file after the script name. It will read in the file, putting each line
>into an
>element of the array
Hi Alberto,
Sorry if I point out something obvious... from the page:
#
# The high-level module needs PIL to produce actual images from the
pixel-data. PIL can be downloaded from PythonWare.
Do you have PIL installed? The fact that the image cannot be created
just bit me...
Hugo
Alberto Troia
hello,
you can use this model:
day, month, year = input("Please enter the day, month and year numbers: ") date1 = '%s/%s/%s' % (month, day, year)
months = {1:"January", 2:"February", 3:"March", 4:"April", 5: "May", 6: "June", 7: "July", 8: "August", 9: "Septe
I would suggest you use the built in datetime modules or egenix mx.DateTime.
for example
>>> import datetime
>>> year = "05"; month="09";day="23"
>>> dateobj = datetime.date(int(year)+2000, int(month), int(day))
>>> dateobj.strftime("%A %B %y")
'Friday September 05'
>>>
obviously you need to loo
Hello
Does anyone have any idea on how i could simplify the following program by using strings?
# dateconvert2.py
# Converts day month and year numbers into two date formats
import string
def main():
# get the day month and year
day, month, year = input("Please enter the day, month a
Hey all
If you noticed I also admitted that I don't want to crack it but I needed
for testing
In fact if I wanted to crack 200 licenses I wouldn't be asking you guys for
help on this program
By the way I bought 10 licenses from them so crime...I really don't
think so
Let's see:
200 *10 $u
Ed Singleton wrote:
> I'd like a little advice on whether I'm being really stupid here.
>
> Having researched editors and stuff, I've not quite found what I'm
> looking for, though Vim comes close (except that it's extremely
> difficult to work out what to do with it).
>
> My instinct was to try
Hi Paul,
works great and within a seond, if I just uncomment the scipy imports.
This was easy, but without your help I still would stare at my screen
and think it's hopeless.
Thanks,
Christian
On 23 Sep 2005, at 13:18, paul brian wrote:
> THis sounds like a recursive import, which frankly shou
I'd like a little advice on whether I'm being really stupid here.
Having researched editors and stuff, I've not quite found what I'm
looking for, though Vim comes close (except that it's extremely
difficult to work out what to do with it).
My instinct was to try and write a small program similar
Hi, everyone. Just a note of thanks to all of you who participate on
the tutor list. I recently finished my first python CGI program, but I
didn't have to post a lot of questions because most had been asked and
answered already : >) For example, I wondered how to get unique file
names for dynam
Christian Meesters wrote:
> Hi,
>
> PyDoc is working well, if invoked without flags on the modul in
> question. But when I use it with '-w' to produce html-output, I get an
> extremely long Traceback after a runtime of an hour or two. Here is a
> short part from it:
> "/System/Library/Framew
bob wrote <<>>
Sorry bob, that's what comes of posting my question last thing at night when
finding the way upstairs is difficult enough.
In perl I can write this:
@array = <>;
print @array;
If I save that and call it from the command line, I can include the name of a
file after the script na
>It is included as part of the standard
>library (as are all the modules in the doc
>Danny referenced).
Thanks, Kent.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi,
PyDoc is working well, if invoked without flags on the modul in
question. But when I use it with '-w' to produce html-output, I get an
extremely long Traceback after a runtime of an hour or two. Here is a
short part from it:
Traceback (most recent call last):
File "/usr/bin/pydoc"
[Kent Johnson]
Here are some more resources for you.
This cookbook recipe is very similar to what you want to do, just
customize workerThread1 to do the actual work. It shows how to use a
Queue to communicate back to the GUI thread.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965
[EMAIL PROTECTED] wrote:
>>>I am coming to Python from Perl. Does Python have
>>>anything like the diamond operator found in Perl?
>
>
>
>>Python includes a module called 'fileinput' that does sorta this:
>> http://www.python.org/doc/lib/module-fileinput.html
>>If you have more questions, ple
>> I am coming to Python from Perl. Does Python have
>>anything like the diamond operator found in Perl?
>Python includes a module called 'fileinput' that does sorta this:
>http://www.python.org/doc/lib/module-fileinput.html
>If you have more questions, please feel free to ask.
>Good luck
On 9/22/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I would like to insert string.join(msgList,"") into the following program
> where do I insert it?
do you want to build a temporary list and join its elements
afterwards? This can look like:
# Loop through each substring and build A
36 matches
Mail list logo