[Tutor] Python tutor

2006-03-27 Thread Noufal Ibrahim
Greetings all, Are there any programs for python that offer an "interactive" tutorial? Something on the lines of the builtin emacs tutorial (which is basically just a buffer that tells you to try this and try that with itself) or the Inkscape tutorial (which is an SVG document that comes along w

[Tutor] Object Oriented Programmin

2006-03-27 Thread Kaushal Shriyan
Hi ALL I have gone through the object oriented programming in Python, I am not able to understand OOP concept in python, is there a methodical way to understand it and simplfy things Thanks in Advance Regards Kaushal ___ Tutor maillist - Tutor@pyth

Re: [Tutor] using BeautifulSoup

2006-03-27 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > anchor.findNext('code') fails: > > anchor = soup.fetch('a', {'href': '/wiki/List_of_country_calling_codes'}) > print anchor > > [Calling code] > > anchor.findNext('code') > [] are you sure that's what you got? Looks like an AttributeError to me - anchor is a *li

Re: [Tutor] setdefault method

2006-03-27 Thread Kent Johnson
Terry Carroll wrote: freq = {} sampletext = "norwegian blue" for char in sampletext: > > ... freq[char] = freq.setdefault(char,0)+1 Although I'm a big fan of setdefault() I think this particular example is better written as freq[char] = freq.get(char,0)+1 There is no need to s

Re: [Tutor] setdefault method

2006-03-27 Thread Kent Johnson
Carroll, Barry wrote: > Greetings: > > What is the purpose of the dictionary method setdefault(k[, x])? setdefault() is perhaps badly named, but it is very useful. It doesn't do what you think it does! From the docs: setdefault() is like get(), except that if k is missing, x is both return

Re: [Tutor] Data Type with Dictionary and List Behavior

2006-03-27 Thread John Fouhy
On 28/03/06, Carroll, Barry <[EMAIL PROTECTED]> wrote: > 1. Access by name (dict) > 2. Access by position (list) > 3. Addition of new items (dict, list) > 4. Set a 'last used' item (??) > 5. Set a 'default' item (dict???) Probably your best bet is to define y

Re: [Tutor] setdefault method

2006-03-27 Thread Terry Carroll
On Mon, 27 Mar 2006, Carroll, Barry wrote: > So, what then is the proper use of setdefault()? And, if d.setdefault > does not actually assign a default value for d, is there a way to do > this? It's a somewhat misleading name, but setdefault a) looks up an entry in a dictionary and c) returns i

[Tutor] Data Type with Dictionary and List Behavior

2006-03-27 Thread Carroll, Barry
Greetings: I have a function that computes the checksum of an integer, including or excluding digits in the computation based on the content of a mask string. For example, cksum(123456789, '***...***') will do its computation on 123789, masking out the three non-significant digits. M

Re: [Tutor] Turnkey Python on a USB stick

2006-03-27 Thread Michael Sparks
On Monday 27 March 2006 22:21, Steve Slevinski wrote: > Does this sound reasonable?  Are their any alternatives to Movable > Python? (http://www.voidspace.org.uk/python/movpy/) Hi Steve, I've got no experience of setting up such a beast or using movable python, but I just wanted to say it sounds

[Tutor] setdefault method

2006-03-27 Thread Carroll, Barry
Greetings: What is the purpose of the dictionary method setdefault(k[, x])? For example assume the following dictionary: >>> colors = {'green':(0,255,0), 'red':(255,0,0), 'blue':(0,0,255), >>> 'white':(255,255,255), 'black':(0,0,0)} >>> Now, execute the statement: >>> colors.setdefault('black

[Tutor] Turnkey Python on a USB stick

2006-03-27 Thread Steve Slevinski
Hi list, I like the idea of portable apps. Load a USB drive and you're ready to go. I am switching from PHP to Python and I'm curious if anyone has tried using USB sticks for either development or distribution? I was looking at purchasing Movable Python for a USB stick. I was then going to l

Re: [Tutor] html and mod_python

2006-03-27 Thread Patty
> Can you please give me a quick example of how to do this: Nevermind. I figured it out. Thanks anyway :-) Patty ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] using BeautifulSoup

2006-03-27 Thread jonasmg
[EMAIL PROTECTED] writes: >>jonasmg at softhome.net wrote: >>> Hi! >>> >>> I'm trying to use BeautifulSoup for get data from a table (on right) from: >>> http://en.wikipedia.org/wiki/United_states >>> >>> i.e. i would get data from 'Calling code' that it would be '+1' >>> >>>

[Tutor] grab a secodary window content

2006-03-27 Thread Carlo Capuano
Hi to all! I'm playing around with VideoCapture and vpython, both open a secondary window with nice images on it, well the one with my face is not so great, anyway I wish to grab the content and put it into a PIL Image, in VideoCapture there are a methods called saveSnapshot and getImage, but some

Re: [Tutor] html and mod_python

2006-03-27 Thread Patty
Hi, Can you please give me a quick example of how to do this: > Then change printbox() to create the > tag using a loop over the value. For each value, check to see if it is > the same as the value passed in and generate the appropriate option tag. The way i have it right now is:

Re: [Tutor] compilte python to an executable file.

2006-03-27 Thread Varun Soundararajan
hi,   I face a typical problem that most python programmers face. Most users only want a click and run kind of thing..they are uninterested  to install any software on their system , be it python or any other software..so the solution is to pack the code up as a py2exe program for windows and ask t

Re: [Tutor] using BeautifulSoup

2006-03-27 Thread jonasmg
>jonasmg at softhome.net wrote: >> Hi! >> >> I'm trying to use BeautifulSoup for get data from a table (on right) from: >> http://en.wikipedia.org/wiki/United_states >> >> i.e. i would get data from 'Calling code' that it would be '+1' >> >> -- >> >> import urll

Re: [Tutor] compilte python to an executable file.

2006-03-27 Thread jonasmg
>jonasmg at softhome.net wrote: >> Hi! >> >> I'm trying to use BeautifulSoup for get data from a table (on right) from: >> http://en.wikipedia.org/wiki/United_states >> >> i.e. i would get data from 'Calling code' that it would be '+1' >> >> -- >> >> import urllib2

Re: [Tutor] compilte python to an executable file.

2006-03-27 Thread Kent Johnson
Ars wrote: > Would a py2exe program be practical for a commercial program? I'd think > people could read your source code too easily. I think it is possible to create py2exe files that don't contain source code, just compiled pyc files. Kent ___ Tutor

Re: [Tutor] compilte python to an executable file.

2006-03-27 Thread Kent Johnson
Keo Sophon wrote: > On Monday 27 March 2006 10:38, Ars wrote: > >>>On 27/03/06, Keo Sophon <[EMAIL PROTECTED]> wrote: >>> hi all, Does anyone know how to compile a python filename.py to an executable >> >>file? >> > > > I don't know how python creates executable file. The purpose is

Re: [Tutor] compilte python to an executable file.

2006-03-27 Thread Varun Soundararajan
Hi jack,   You are right. py2exe may not fit well in commercial software products that arent in the open source model. An executable that was py2exe'd could well be converted back to the source.. I feel that its one of the restrictions thats in the way of enterprization of python...(agreed google u

Re: [Tutor] using BeautifulSoup

2006-03-27 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi! > > I'm trying to use BeautifulSoup for get data from a table (on right) from: > http://en.wikipedia.org/wiki/United_states > > i.e. i would get data from 'Calling code' that it would be '+1' > > -- > > import urllib2 > from BeautifulSoup

[Tutor] using BeautifulSoup

2006-03-27 Thread jonasmg
Hi! I'm trying to use BeautifulSoup for get data from a table (on right) from: http://en.wikipedia.org/wiki/United_states i.e. i would get data from 'Calling code' that it would be '+1' -- import urllib2 from BeautifulSoup import BeautifulSoup url="http://en.wikipedia

Re: [Tutor] newbie exercises

2006-03-27 Thread Steve Nelson
On 3/27/06, josip <[EMAIL PROTECTED]> wrote: > Can someone give me exercises to do with loops, maybe functions to? How about a program that produces truth tables for the basic gates? AND, NAND, NOT, OR, XOR? You could write a function for each gate, and one to produce a truth table. S. __

[Tutor] newbie exercises

2006-03-27 Thread josip
Hi,   Python is my first language. I have finished loops, now I'm going to functions. I'm working with Learning Python 2ed book. Can someone give me exercises to do with loops, maybe functions to?   Thanks Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger wit

Re: [Tutor] Learning Python

2006-03-27 Thread Kaushal Shriyan
On 3/27/06, Noufal Ibrahim <[EMAIL PROTECTED]> wrote: > > On Mon, March 27, 2006 4:39 pm, Kaushal Shriyan wrote: > > Hi > > > > I am a novice in Python, Which is the best source of learning python > > for a beginner > > If you're already a "programmer", then the python tutorial at > http://docs.pyt

Re: [Tutor] Learning Python

2006-03-27 Thread Noufal Ibrahim
On Mon, March 27, 2006 4:39 pm, Kaushal Shriyan wrote: > Hi > > I am a novice in Python, Which is the best source of learning python > for a beginner If you're already a "programmer", then the python tutorial at http://docs.python.org/tut/tut.html + a working python installation is enough IMHO.

Re: [Tutor] Learning Python

2006-03-27 Thread Kent Johnson
Kaushal Shriyan wrote: > Hi > > I am a novice in Python, Which is the best source of learning python > for a beginner Read one of the tutorials listed here: http://wiki.python.org/moin/BeginnersGuide/NonProgrammers Write simple programs to try out what you have learned. Ask questions here when

[Tutor] Learning Python

2006-03-27 Thread Kaushal Shriyan
Hi I am a novice in Python, Which is the best source of learning python for a beginner Regards Kaushal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Dynamically naming functions

2006-03-27 Thread Ed Singleton
On 26/03/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > Ed Singleton wrote: > > How does one go about creating functions, classes, or callable objects > > when you don't know their name in advance? (For example you want to > > read their names in from a text file or database). > > > > I want to use