Re: [Tutor] more encoding strangeness

2008-12-23 Thread Kent Johnson
On Tue, Dec 23, 2008 at 2:10 AM, Eric Abrahamsen e...@ericabrahamsen.net wrote: Hi there, I'm configuring a python command to be used by emacs to filter a buffer through python markdown, and noticed something strange. If I run this command in the terminal: python -c import sys,markdown;

Re: [Tutor] Very basic question about lists

2008-12-23 Thread spir
I see I have to do a loop inside a loop and that this the right expression if word == 'ar' or word == 'ko': but this is not: if word == 'ar' or 'ko': In the last example: as the 'or' operator has the least priority, it will be applied last. Which means that all other operations in the

Re: [Tutor] MP3Info class usage

2008-12-23 Thread Gareth at Serif
Your advice is spot on and I'm well on my way... your Windows installation advice should be in the readme, if anyone's listening :-) Thanks again, Gareth -- View this message in context: http://www.nabble.com/MP3Info-class-usage-tp20934673p21143262.html Sent from the Python - tutor mailing

[Tutor] Fwd: Class Extend Help

2008-12-23 Thread Omer
Hey! Thx for the help, @Martin, At the moment my only need is basic retrievals of source code of basic files from the internet, so no need for urllib2 or response objects just yet. Now, copying and pasting line by line into the interactive mode I get this: from urllib import urlopen class

Re: [Tutor] Fwd: Class Extend Help

2008-12-23 Thread Kent Johnson
On Tue, Dec 23, 2008 at 9:31 AM, Omer jaggojaggo...@gmail.com wrote: from urllib import urlopen class fetch(urlopen): ... def __init__(self,*args): ... urlopen.__init__(self, *args) ... self.content = self.read() ... Traceback (most recent call last): File

[Tutor] help needed from python beginner

2008-12-23 Thread moham ilias
can anybody help me to get the example codes for some existing python projects. pls help in this regard ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Fwd: Class Extend Help

2008-12-23 Thread Richard Lovely
OK, going on Kent's post: from urllib import urlopen class fetch(object): def __init__(self, *args): self.response = urlopen(*args) self.content = self.response.read() I forgot urlopen was a function. It made sense in my head for it to be a class, instead of _returning_ a

Re: [Tutor] help needed from python beginner

2008-12-23 Thread Kent Johnson
On Tue, Dec 23, 2008 at 10:30 AM, moham ilias mujil...@gmail.com wrote: can anybody help me to get the example codes for some existing python projects. pls help in this regard I'm not sure I understand your question. Do you want examples to look at? Most of the Python standard library is

Re: [Tutor] help needed from python beginner

2008-12-23 Thread Alan Gauld
moham ilias mujil...@gmail.com wrote in message news:74b58e470812230730n4c3c5d1eg9f44a87b1bf9...@mail.gmail.com... can anybody help me to get the example codes for some existing python projects. pls help in this regard For simple examples try the Useless Python web site. In particular

[Tutor] optparse

2008-12-23 Thread Matt Herzog
Hi All. I want to write a script that will emulate grep to some extent. This is just an exercise for me. I want to run the script like this: ./pythongrep directory searchstring Just like grep, I want it to print: filename, instance_of_match As of now, the script can't find anything I tell it

Re: [Tutor] python parser

2008-12-23 Thread bob gailer
I'm forwarding this to the list. Please always reply-all so a copy goes to the list. johnf wrote: On Monday 22 December 2008 03:03:44 pm you wrote: More thoughts on converting VFP to Python: line-by-line can take into account control structures. One just increases or decreases the indent

Re: [Tutor] optparse

2008-12-23 Thread Kent Johnson
On Tue, Dec 23, 2008 at 3:10 PM, Matt Herzog m...@blisses.org wrote: for filename in os.listdir(directory): result = re.match(s, filename) print result You never open and read the files. You are searching for the pattern in the filename, not in the contents of the file.

Re: [Tutor] optparse

2008-12-23 Thread Alan Gauld
Kent Johnson ken...@tds.net wrote for filename in os.listdir(directory): result = re.match(s, filename) print result You never open and read the files. You are searching for the pattern in the filename, not in the contents of the file. Also note that match() only

[Tutor] help finding recurring cycle

2008-12-23 Thread col speed
Hello there, I am learning python as a hobby in my spare time. I enjoy doing project euler, not that I am any good at maths, but it gives me problems to solve in python! Please Note: I do not expect (or want) you to give me the solution, if you could just point me in the right direction - that

Re: [Tutor] help finding recurring cycle

2008-12-23 Thread Kent Johnson
On Tue, Dec 23, 2008 at 8:20 PM, col speed ajarnco...@gmail.com wrote: I've written a division function that gives more decimal places than the one already in python. What my poor old brain can't work out is how to find a recurring cycle which isn't disastrously complicated (as the cycle

Re: [Tutor] help finding recurring cycle

2008-12-23 Thread bob gailer
Kent Johnson wrote: On Tue, Dec 23, 2008 at 8:20 PM, col speed ajarnco...@gmail.com wrote: I've written a division function that gives more decimal places than the one already in python. What my poor old brain can't work out is how to find a recurring cycle which isn't disastrously

[Tutor] Word Frequency Chart

2008-12-23 Thread Ishan Puri
Hello, I am a beginner with Python but I understand a lot of linguistics. I am a high school student. I needed help (from the beginning) making a word frequency chart that I can use to chart out the numerical frequencies of words. Usually I can understand the code if it is annotated well,

Re: [Tutor] help finding recurring cycle

2008-12-23 Thread col speed
Thank you, thank you thank you! I'm now well on my way to solving my 35th problem!! The wiki is fantastic, I thought of course - I should have known that! It's easy when you know how. Thanks again, especially for the prompt replies 2008/12/24 bob gailer bgai...@gmail.com Kent Johnson wrote: