Re: [Tutor] How to test for a remainder from division

2007-05-15 Thread Matt Smith
Hi, Thanks for all the help, I guessed that there would be a module out there providing a function to do this but wanted to go through the process as a learning exercise. The modulus operator was just what I was looking for, I had been trying to check for a difference between the division and the

Re: [Tutor] html links

2007-05-15 Thread Sönmez Kartal
Hi, import urllib from BeautifulSoup import BeautifulSoup page = urllib.urlopen(url) # url is the page address, if you are reading a file in your hard drive you could use just open(filename) too, and no needing to urllib soup = BeautifulSoup(page) #links = [str(link) for link in

[Tutor] File access by os.system

2007-05-15 Thread lohith madireddy
Hello, I am kind of stuck with this problem for many days. I would really appreciate the person who helps me in solving this problem. Here is how I am stuck.. I have files named 'x.pdb', 'y.pdb',. in one directory. I am using python to read the files in that directory and do a

Re: [Tutor] Web

2007-05-15 Thread Alan Gauld
Jeff Molinari [EMAIL PROTECTED] wrote How exacly can you use python to create a web site? Short question, lots of answers! Have a look at the WebProgramming Topic Guide on python.org. http://wiki.python.org/moin/WebProgramming And check out the CgiScripts topic then the Web Frameworks topic.

Re: [Tutor] html links

2007-05-15 Thread Alan Gauld
max . [EMAIL PROTECTED] wrote does anyone know of a tutorial for finding links in a web site with python. Beautifulsuop has been mentioned but its not part of standard python. Her is an example of the standard library parser: html = ''' htmlheadtitleTest page/title/head body center h1Here

Re: [Tutor] Text matching

2007-05-15 Thread Gardner, Dean
So I took Kents advice and refactored but I have uncovered another problem which I am hoping people may be able to help with. I realized that the string I was using to identify the end of a record can in some cases not be found (i.e. if a commit wasn't reviewed). This can lead to additional

Re: [Tutor] File access by os.system

2007-05-15 Thread Alan Gauld
lohith madireddy [EMAIL PROTECTED] I have files named 'x.pdb', 'y.pdb',. in one directory. I am using python to read the files in that directory and do a system operation on each of the file using os.system. When I use this, it always gives an error saying 'could not read the file'.

[Tutor] ImportError: No module named _apache

2007-05-15 Thread ShivKumar Anand
dear all, I am trying to implement a text from mod_python manual. the code is: from mod_python import apache def handler(req):req.content_type =text/plain\n\n req.send_http_header()req.write(Hello World!!!)return apache.ok and the conf file of apache is having Directory

Re: [Tutor] How to test for a remainder from division

2007-05-15 Thread Kent Johnson
Matt Smith wrote: ere is the final code I have come up with, any comments? # A program to determine whether a year is a leap year or not def is_leap_year(year): # Function that accepts a year as input and returns true if it is a leap year, false if it is not if year % 4 == 0 and

Re: [Tutor] Text matching

2007-05-15 Thread Kent Johnson
Gardner, Dean wrote: So I took Kents advice and refactored but I have uncovered another problem which I am hoping people may be able to help with. I realized that the string I was using to identify the end of a record can in some cases not be found (i.e. if a commit wasn't reviewed). This can

[Tutor] Text matching

2007-05-15 Thread Jason Massey
heh... forwarding to the list, too. -- Forwarded message -- From: Jason Massey [EMAIL PROTECTED] Date: May 15, 2007 6:51 AM Subject: Re: [Tutor] Text matching To: Gardner, Dean [EMAIL PROTECTED] Look at it a different way. If the one thing that is sure to be there is the

[Tutor] object design question

2007-05-15 Thread Kent Tenney
Howdy, I would be interested in some discussion of which of the following approaches is preferred and why. class RstManager: def __init__(self, text): self.text = text self.parseRst() def parseRst(self): parsed = do stuff to self.text

Re: [Tutor] File access by os.system

2007-05-15 Thread Mike Hansen
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Gauld Sent: Tuesday, May 15, 2007 1:44 AM To: tutor@python.org Subject: Re: [Tutor] File access by os.system lohith madireddy [EMAIL PROTECTED] I have files named 'x.pdb',

Re: [Tutor] How to test for a remainder from division

2007-05-15 Thread Kent Johnson
Matt Smith wrote: Here is the implementation of calendar.isleap(): def isleap(year): Return 1 for leap years, 0 for non-leap years. return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) Hi Kent, Thanks for the help. For future reference how do I go look at the

Re: [Tutor] object design question

2007-05-15 Thread Kent Johnson
Kent Tenney wrote: Howdy, I would be interested in some discussion of which of the following approaches is preferred and why. class RstManager: def __init__(self, text): self.text = text self.parseRst() def parseRst(self): parsed = do

Re: [Tutor] File access by os.system

2007-05-15 Thread Rikard Bosnjakovic
On 5/15/07, Mike Hansen [EMAIL PROTECTED] wrote: Should the os.system command be something like command = dsspcmbi -v %s %s %(Pdb, temp1) os.system(command) ? Yes. -- - Rikard - http://bos.hack.org/cv/ ___ Tutor maillist - Tutor@python.org

Re: [Tutor] How to test for a remainder from division

2007-05-15 Thread Eric Walstad
Hey Matt, Matt Smith wrote: I guessed that there would be a module out there providing a function to do this but wanted to go through the process as a learning exercise. Good form, old boy. Here is the final code I have come up with, any comments? I think your code looks fine. I like to do

Re: [Tutor] ImportError: No module named _apache

2007-05-15 Thread Eric Walstad
Hey ShivKumar, ShivKumar Anand wrote: *I am getting this error message:* Traceback (most recent call last): File C:\Python24\exp\Web\SoapTest.py, line 1, in ? from mod_python import apache File C:\Python24\lib\site-packages\mod_python\apache.py, line 28, in ? import _apache

Re: [Tutor] object design question

2007-05-15 Thread Alan Gauld
Kent Johnson [EMAIL PROTECTED] wrote Howdy, I would be interested in some discussion of which of the following approaches is preferred and why. class RstManager: def __init__(self, text): self.parsed = parseRst(text) def parseRst(self, text): parsed = do stuff to

[Tutor] python project books/webs from scratch? and python OOP

2007-05-15 Thread Jesus Rodriguez
Hi! I have good python knowledge but I don't know how to face a project.Yes, i can do some small projects, but i'm scared of big projectsI don't know how to start!! Then, I'm looking for a book or web with projects, like console text games or console programs explained from scratch to

Re: [Tutor] How to test for a remainder from division

2007-05-15 Thread Terry Carroll
On Tue, 15 May 2007, Kent Johnson wrote: Matt Smith wrote: Thanks for the help. For future reference how do I go look at the implementation of a particular function (the ones coded in Python, I don't know C)? Look in the lib directory that was installed with Python. The location

Re: [Tutor] File access by os.system

2007-05-15 Thread Luke Paireepinart
Rikard Bosnjakovic wrote: On 5/15/07, Mike Hansen [EMAIL PROTECTED] wrote: Should the os.system command be something like command = dsspcmbi -v %s %s %(Pdb, temp1) os.system(command) ? Yes. Not Quite, I think. import tempfile help(tempfile.TemporaryFile) Help on function