Re: [Tutor] Python help

2009-04-25 Thread Alan Gauld
"IT_ForMe" wrote cart = {"apple":2.00, "orange":2.50, "banana":1.75} You set this up but then don't use it. Also your problem statement said *some* items were taxable, implying some were not. You might want to record whether an item is taxable in the dictionary too. print cart apple = 2

[Tutor] Is it syntactic,semantic or runtime?

2009-04-25 Thread prasad rao
helloI wrote a function to fetch data using urllib and displaying the data using internet Explorer. it is not preparing the html file So opening blank Explorer after complaining th html file not found. Where is the problem? Can I display the data read from a site without preparing a html file?

Re: [Tutor] Is it syntactic,semantic or runtime?

2009-04-25 Thread Sander Sweers
2009/4/25 prasad rao : > So opening blank Explorer after complaining th html file not found. > Where is the problem? There are typing errors on the below... > > def pp(): > @@@ import urllib > @@@ import subprocess > @@@ so=urllib.urlopen('http://www.asstr.org') > @@@ data=so.read() > @@@ de=op

[Tutor] output formatting

2009-04-25 Thread Matt Domeier
Hello, I have a series of lists that I need to output into files with a specific format. Specifically, I need to have line breaks after each entry of the list, and I need to do away with the ['..'] that accompany the data after I transform the list into a string. Can I simply append a '\n

Re: [Tutor] output formatting

2009-04-25 Thread W W
On Fri, Apr 24, 2009 at 10:57 PM, Matt Domeier wrote: > Hello, > > I have a series of lists that I need to output into files with a specific > format. Specifically, I need to have line breaks after each entry of the > list, and I need to do away with the ['..'] that accompany the data after I > t

Re: [Tutor] Is it syntactic,semantic or runtime?

2009-04-25 Thread Kent Johnson
On Sat, Apr 25, 2009 at 5:38 AM, prasad rao wrote: > hello > I wrote a function to fetch data using urllib and displaying the data > using internet Explorer. > it is not preparing the html file > So opening blank Explorer after complaining th html file not found. > Where is the problem? > Can I di

Re: [Tutor] how to compile python3.0

2009-04-25 Thread عماد نوفل
On Fri, Apr 24, 2009 at 11:59 AM, Shaofeng NIu wrote: > that worked for me,too :) thanks to all the peopel helping me > > 2009/4/24 Dayo Adewunmi > >> Shaofeng NIu wrote: >> >>> I tried to compile and install python3.0 from source,but after "make",it >>> shows: >>> >>> Python build finished, but

Re: [Tutor] Threading...

2009-04-25 Thread Kent Johnson
On Fri, Apr 24, 2009 at 5:26 PM, Spencer Parker wrote: > I have a script that I want to test MySQL sonnections with.  The way I have > the script working is to just create connections, but I realized that it is > going to wait for the first one to stop before starting a new connection.  I > want t

Re: [Tutor] Is it syntactic,semantic or runtime?

2009-04-25 Thread Alan Gauld
"prasad rao" wrote helloI wrote a function to fetch data using urllib and displaying the data using internet Explorer. it is not preparing the html file So opening blank Explorer after complaining th html file not found. The specific problem has been addressed but in general it is wise to m

Re: [Tutor] output formatting

2009-04-25 Thread Dave Angel
Matt Domeier wrote: Hello, I have a series of lists that I need to output into files with a specific format. Specifically, I need to have line breaks after each entry of the list, and I need to do away with the ['..'] that accompany the data after I transform the list into a string. Can

Re: [Tutor] Is it syntactic,semantic or runtime?

2009-04-25 Thread prasad rao
hellothanks .After inserting back slashes and de.close it is working well thanks for the help prasad ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Working with lines from file and printing to another keeping sequential order

2009-04-25 Thread Dan Liang
Dear Tutors, I have a file from which I want to extract lines that end in certain strings and print to a second file. More specifically, I want to: 1) iterate over each line in the file, and if it ends in "yes", print it. 2) move to the line following the one described in #1 above, and if it end

Re: [Tutor] Working with lines from file and printing to another keeping sequential order

2009-04-25 Thread bob gailer
Dan Liang wrote: Dear Tutors, I have a file from which I want to extract lines that end in certain strings and print to a second file. More specifically, I want to: 1) iterate over each line in the file, and if it ends in "yes", print it. 2) move to the line following the one described in #1

[Tutor] # what do I do now to kill the the Windows program which has finished its work?

2009-04-25 Thread Ian Campbell
I am converting a Windows ProComm script into Python and need help. ; previous Procomm script here run "c:\buy.exe" taskId; this runs the c:\buy.exe program and assigns the task identification number to the integer variable called "taskId" pause 1

Re: [Tutor] output formatting

2009-04-25 Thread spir
Le Sat, 25 Apr 2009 11:02:47 -0400, Matt Domeier s'exprima ainsi: > Hi Wayne, > > Yes, that should work perfectly, but it is in writing files that I'm > having the problem. I'm still very new to python, so I only know to > use something like filename.write(str(listname)) to write my list to

Re: [Tutor] output formatting

2009-04-25 Thread Matt Domeier
Hi Wayne, Yes, that should work perfectly, but it is in writing files that I'm having the problem. I'm still very new to python, so I only know to use something like filename.write(str(listname)) to write my list to a file.. Is there a straightforward method of combining the ease of the pri

Re: [Tutor] Working with lines from file and printing to another keeping sequential order

2009-04-25 Thread Dan Liang
Hi Bob and tutors, Thanks Bob for your response! currently I have the current code, but it does not work: ListLines= [] for line in open('test.txt'): line = line.rstrip() ListLines.append(line) for i in range(len(ListLines)): if ListLines[i].endswith("yes") and ListLines[i+1].endswi

Re: [Tutor] Working with lines from file and printing to another keeping sequential order

2009-04-25 Thread Shantanoo Mahajan (शंत नू महा जन)
On 25-Apr-09, at 11:41 PM, Dan Liang wrote: Hi Bob and tutors, Thanks Bob for your response! currently I have the current code, but it does not work: ListLines= [] for line in open('test.txt'): line = line.rstrip() ListLines.append(line) for i in range(len(ListLines)): if Lis

Re: [Tutor] # what do I do now to kill the the Windows program which has finished its work?

2009-04-25 Thread Alan Gauld
"Ian Campbell" wrote os.startfile("c:\\buy.exe" , 'OPEN')# THIS WORKS and returns but does not return the taskID Take a look at the subprocess module. # what do I do now to kill the the Windows program which has finished its work? This is trickier, if the program does not stop it

Re: [Tutor] python books

2009-04-25 Thread chinmaya
On Mon, Apr 13, 2009 at 11:07 PM, sudhanshu gautam wrote: > I am new in python , so need a good books , previously read python Bible > and swaroop but not satisfied . > > > so tell me good books in pdf format those contents good problems also > > > ___ >

Re: [Tutor] python books

2009-04-25 Thread Dayo Adewunmi
chinmaya wrote: On Mon, Apr 13, 2009 at 11:07 PM, sudhanshu gautam mailto:sudhanshu9...@gmail.com>> wrote: I am new in python , so need a good books , previously read python Bible and swaroop but not satisfied . so tell me good books in pdf format those contents good problems a

[Tutor] I may have solved my problem with killing tasks in Windows

2009-04-25 Thread Ian Campbell
I am trying to use this so maybe no one has to reply... sorry to inconvenience anyone. I got it from Google but did not copy his name and cannot give my thanks to original author, sorry. import subprocess from win32event import WaitForSingleObject, WAIT_TIMEOUT from win32api import Termi

Re: [Tutor] # what do I do now to kill the the Windows program which has finished its work?

2009-04-25 Thread Emile van Sebille
Alan Gauld wrote: then try killing the thread which may kill the program, or if not, use the Windows API to kill the program (gets messy). This is easier on Unix in my experience! Sysinternals created pstools for windows that I generally use for this kind of thing, particularly when it gets me

Re: [Tutor] I may have solved my problem with killing tasks in Windows

2009-04-25 Thread Alan Gauld
"Ian Campbell" wrote I am trying to use this so maybe no one has to reply... sorry to inconvenience anyone. No inconvenience and I'm glad you posted the solution you found. That is pretty much what I had in mind but I didn't know you could get the _handle from the return value in Pope

Re: [Tutor] Working with lines from file and printing to another keeping sequential order

2009-04-25 Thread bob gailer
Dan Liang wrote: Hi Bob and tutors, Thanks Bob for your response! currently I have the current code, but it does not work: [snip] Thank you for code, sample data and more complete specs. Lines in the file look like following: word1 word2 word3 word4 yes word1 word2 word3 word4 no

Re: [Tutor] # what do I do now to kill the the Windows program which has finished its work?

2009-04-25 Thread Kent Johnson
On Sat, Apr 25, 2009 at 11:35 AM, Ian Campbell wrote: > I am converting a Windows ProComm script into Python and  need help. > > ;  previous Procomm  script here > > run "c:\buy.exe" taskId                ; this runs the c:\buy.exe program > and assigns the  task identification number to the integ