[Tutor] overlap of ranges

2005-05-03 Thread János Juhász
Hi All, one of my colleague asked me, about how the overlap of two ranges can be calculated easily. >>> a = (24,27) # range1 (endpoint1,endpoint2) >>> b = (10,227) # range1 (endpoint1,endpoint2) >>> min( max(a), max(b) ) - max( min(a), min(b) ) 3 When the result is positive, then the two ranges

Re: [Tutor] nested os.popen()

2005-05-03 Thread Danny Yoo
On Tue, 3 May 2005, Jules Bravo wrote: > I'm trying to create a program that can recreate the unix pipe. So > basically I need to be able to take something like "ls *.py | du | wc" > and be able to run it just like unix would, doing a wordcount of the du > of all files that end with .py. My ques

Re: [Tutor] Problem with threading

2005-05-03 Thread Max Noel
On May 3, 2005, at 20:52, Danny Yoo wrote: > ## >cron(8) examines cron entries once every minute. > >The time and date fields are: > > field allowed values > - -- > minute 0-59 >

[Tutor] nested os.popen()

2005-05-03 Thread Jules Bravo
I'm trying to create a program that can recreate the unix pipe. So basically I need to be able to take something like "ls *.py | du | wc" and be able to run it just like unix would, doing a wordcount of the du of all files that end with .py. My question is how would I do this without being able to

Re: [Tutor] Problem with threading

2005-05-03 Thread Danny Yoo
On Tue, 3 May 2005, Max Noel wrote: > > I believe that cron has a resolution of a minute, so now it doesn't > > sound that cron is so viable. But how about writing a program that > > just continues to run as a "daemon" service in the background? A > > simple example is something like: > >

Re: [Tutor] Problem with threading

2005-05-03 Thread Max Noel
On May 3, 2005, at 08:57, Danny Yoo wrote: > I believe that cron has a resolution of a minute, so now it doesn't > sound > that cron is so viable. But how about writing a program that just > continues to run as a "daemon" service in the background? A simple > example is something like: >

[Tutor] Text Directly to Screen?

2005-05-03 Thread Aaron Elbaz
Hi, My question has to do with outputting text. Normally, you ouput to a console or a gui...but for my task, a hack might be needed.. What I want to do is output text *directly* to the screen. And if possible, restrict the window area to specific dimensions (top right in mind). It should basical

Re: [Tutor] Subract Month From Date

2005-05-03 Thread Karl Pflästerer
On 3 Mai 2005, [EMAIL PROTECTED] wrote: > What would be the simplest way to extract the Month and Year for one month > prior to the current month? I have been looking for a way to create a Date > object with the current date, and then subtract a month from it. Say it is > currently "January 1st,

Re: [Tutor] Subract Month From Date

2005-05-03 Thread Tim Peters
[Gooch, John] > Thank you for the idea, I could have been more clear that days part of the > date isn't important. Here is what I came up with: > >currentDate = datetime.datetime.fromtimestamp( time.time() ) Easier: today = datetime.date.today() >archMonth = 0 >archYear = 0 >

Re: [Tutor] Subract Month From Date

2005-05-03 Thread Gooch, John
Thank you for the idea, I could have been more clear that days part of the date isn't important. Here is what I came up with: currentDate = datetime.datetime.fromtimestamp( time.time() ) archMonth = 0 archYear = 0 if ( currentDate.month == 1 ): archMonth = 12 archYe

Re: [Tutor] Subract Month From Date

2005-05-03 Thread Kent Johnson
Gooch, John wrote: > What would be the simplest way to extract the Month and Year for one month > prior to the current month? I have been looking for a way to create a Date > object with the current date, and then subtract a month from it. Say it is > currently "January 1st, 2005", I would like to

[Tutor] Subract Month From Date

2005-05-03 Thread Gooch, John
What would be the simplest way to extract the Month and Year for one month prior to the current month? I have been looking for a way to create a Date object with the current date, and then subtract a month from it. Say it is currently "January 1st, 2005", I would like to be able to subtract a month

Re: [Tutor] problem

2005-05-03 Thread Allen John Schmidt, Jr.
Feziwe Mpondo wrote: >hi >problem :modification of a guessing game excersize to a password asking >program. her's what i tried. >s = raw_input > > What is this here for? >#asks for a password >#prints it if correct >password = input( "Tell me a password: ") > > This is correct, but >passwor

Re: [Tutor] tokenize row numbering

2005-05-03 Thread Chris Smith
> From: Andrei >> ### >> # line 1 according to tokenize tuple >> # line 2 >> a=b #line 3 >> ### >> >> Does anyone have an idea of *why* the rows/physical lines of code >> beginning their count at 1 instead of 0? In order to process the code >> I > > The snippet above shows that numbering begins

[Tutor] problem

2005-05-03 Thread Feziwe Mpondo
hi problem :modification of a guessing game excersize to a password asking program. her's what i tried. s = raw_input #asks for a password #prints it if correct password = input( "Tell me a password: ") password ==dal print password,"Tell me a password: " elif password ==dal print "accurate"

Re: [Tutor] Guessing program

2005-05-03 Thread Kent Johnson
Feziwe Mpondo wrote: > hello > problem : question says modify a guessing program and to keep track of > how many times the user has entered the password wrong. if it more than > 3 times, print "that must have bin though" A few tips: - Start a new thread for your question, don't add it at the end

Re: [Tutor] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-05-03 Thread Feziwe Mpondo
Chris Smith wrote: > > On Friday, Apr 22, 2005, at 10:00 America/Chicago, Max Noel wrote: > >> >>> Do you have a suggestion as to what can I give a module so it has >>> enough information to execute a function that resides in __main__? >>> Here is a visual of what is going on: >>> >>> --__ma

Re: [Tutor] missing module?

2005-05-03 Thread Danny Yoo
> Hello, I get an error message from py2exe that it can't find a module > ntpath.py. I pasted the error message below: > > Traceback (most recent call last): > File "wxApp1.py", line 4, in ? > File "wx\__init__.pyc", line 42, in ? > File "wx\_core.pyc", line 4, in ? > File "wx\_core_.pyc"

Re: [Tutor] Problem with threading

2005-05-03 Thread Danny Yoo
On Tue, 3 May 2005, Alberto Troiano wrote: > In answer to Matt the cameras push the photos via ftp at my server at 1 > photo every 3 seconds Hi Alberto, Just as another note: the folks here have no idea who you mean by Matt. I do know that you mean Matt from [EMAIL PROTECTED], but the folks on