Re: [Tutor] Using the curses module (or a better solution)

2008-10-06 Thread Tony Cappellini
> See the recent discussion of urwid for discussion of a similar problem. > http://thread.gmane.org/gmane.comp.python.tutor/50500/ This looks interesting. Thanks! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] IF statements-1

2008-10-06 Thread Kent Johnson
On Mon, Oct 6, 2008 at 9:48 PM, WM <[EMAIL PROTECTED]> wrote: > TO THIS ORIGINAL POST I GOT SIX REPLIES. > IS THIS THE WAY TO ANSWER? OR SHOULD I DO INDIVIDUAL REPLIES? Either way is OK. It helps to quote a bit of the post to which you are replying, for context. And please don't use all caps, it

[Tutor] IF statment 2

2008-10-06 Thread WM
Hey, guys, forgive me; I can't help being a fool. Just now I READ the program and it worked perfectly! 42 is more than 1 so it printed "More". My error was that I imagined there was a loop where no loop could be. Oh, me; oh, my. ___ Tutor maillist

Re: [Tutor] Using the curses module (or a better solution)

2008-10-06 Thread Kent Johnson
On Mon, Oct 6, 2008 at 6:58 PM, Tony Cappellini <[EMAIL PROTECTED]> wrote: > > > I'm maintaining a framework of tests which are run on a diskless Linux > client, in character mode (no graphical desktop). > > The tests often print out a lot of info, which scrolls off the screen. > > I'd like to add

Re: [Tutor] Help Python String Search

2008-10-06 Thread Kent Johnson
On Mon, Oct 6, 2008 at 5:37 PM, Deitemeyer, Adam R <[EMAIL PROTECTED]> wrote: > Hello, > > I'm a beginner Python user and I have simple python issue I can't seem to > solve. I want to do a truth test on a string to see if a another string is > contained within it. I found that typically the re mo

[Tutor] IF statements-1

2008-10-06 Thread WM
TO THIS ORIGINAL POST I GOT SIX REPLIES. WM wrote: > > I used to do Basic and enjoyed it. Someone said Python was a vastly > > better language than Visual Basic, which I considered playing with. So > > I sought to give it a go but struck a sticking point very early. > > I am now going through t

[Tutor] Using the curses module (or a better solution)

2008-10-06 Thread Tony Cappellini
I'm maintaining a framework of tests which are run on a diskless Linux client, in character mode (no graphical desktop). The tests often print out a lot of info, which scrolls off the screen. I'd like to add a 1-2 line no-scroll-area at the top of the screen, so as to print a message which indica

Re: [Tutor] Help Python String Search

2008-10-06 Thread John Fouhy
2008/10/7 Deitemeyer, Adam R <[EMAIL PROTECTED]>: > I'm a beginner Python user and I have simple python issue I can't seem to > solve. I want to do a truth test on a string to see if a another string is > contained within it. I found that typically the re module has the methods > to accomplish th

[Tutor] Help Python String Search

2008-10-06 Thread Deitemeyer, Adam R
Hello, I'm a beginner Python user and I have simple python issue I can't seem to solve. I want to do a truth test on a string to see if a another string is contained within it. I found that typically the re module has the methods to accomplish this. However, every string I'm searching begins w

Re: [Tutor] Read a random record in dictionary object from csv module reader?

2008-10-06 Thread Kent Johnson
On Mon, Oct 6, 2008 at 3:32 PM, xbmuncher <[EMAIL PROTECTED]> wrote: > import csv > reader = csv.DictReader(open("test_csv.csv", "r")) You should open the file with mode 'rb' > reader is not an actual dictionary from my understanding.. so I don't know > how to access properties like the 'total it

[Tutor] Read a random record in dictionary object from csv module reader?

2008-10-06 Thread xbmuncher
import csv reader = csv.DictReader(open("test_csv.csv", "r")) reader is not an actual dictionary from my understanding.. so I don't know how to access properties like the 'total items' in the dictionary I want to be able to extract a random dictionary entry from the csv file, how can I do this by

Re: [Tutor] Delete file before function ends

2008-10-06 Thread Adrian Greyling
I'll take a peek at the subprocess docs Steve, and see if I can learn something there... Thanks for the suggestion! I'm using WinXP as well Wayne.. Not too sure why yours works, and mine doesn't.. I'll revisit what I'm doing and also check into Steve's suggestion. Adrian On Mon, Oct 6, 200

Re: [Tutor] Delete file before function ends

2008-10-06 Thread W W
What OS are you using, Adrian? On WinXP, this worked fine: import os def files(): os.startfile('myfile.txt') os.remove('myfile.txt') -Wayne ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Delete file before function ends

2008-10-06 Thread Steve Willoughby
On Mon, Oct 06, 2008 at 02:15:06PM -0400, Adrian Greyling wrote: > As a newbie, Alan, I was kinda scared you'd say that "threads" were the > answer here! (It sounds like someone is going to get sucked into a worm > hole or something...) Looks like the next class in my Python education is > going

Re: [Tutor] Delete file before function ends

2008-10-06 Thread Adrian Greyling
Thanks for the input folks. Sadly, Tim's suggestion yields the same results as I was getting previously. My second program very graciously tells me that the file I'm trying to open doesn't exist. Like the code snippet I posted, the timer.sleep(x) line just waits the 'x' seconds until opening 'myt

Re: [Tutor] Delete file before function ends

2008-10-06 Thread Alan Gauld
"Adrian Greyling" <[EMAIL PROTECTED]> wrote that creates my "problem"... What I'd like to do, is create a plain text file, use the associated program to open said textfile, (using os.startfile) and after the associated program has what it needs to open the file and then of course, has the c

Re: [Tutor] IF Statements

2008-10-06 Thread Kent Johnson
On Mon, Oct 6, 2008 at 7:24 AM, Rajeev Nair <[EMAIL PROTECTED]> wrote: > also i believe the first line can also be written as 'x = input('enter > ...') instead of using x=int(raw_input('..') . use raw_input for > string and just input for integer. Yes, although that is not really recommend

[Tutor] Fwd: IF statements

2008-10-06 Thread Kent Johnson
Forwarding to the list... -- Forwarded message -- From: Thomas Walch <[EMAIL PROTECTED]> Date: Mon, Oct 6, 2008 at 10:35 AM Subject: Re: [Tutor] IF statements To: Kent Johnson <[EMAIL PROTECTED]> Entering the code in the interpreter I could not find an issue. No error at all. Mig

Re: [Tutor] IF Statements

2008-10-06 Thread Alan Gauld
"Rajeev Nair" <[EMAIL PROTECTED]> wrote also i believe the first line can also be written as 'x = input('enter ...') instead of using x=int(raw_input('..') . use raw_input for string and just input for integer. No, use input() only in very special circumstances or when experimenting

Re: [Tutor] Delete file before function ends

2008-10-06 Thread Tim Golden
Adrian Greyling wrote: path = "c:\MyFolder\mytextfile.xyz" BTW, I hope you're using raw strings in your real code, or else you're going to come a cropper one day when a filename begins with "t". TJG ___ Tutor maillist - Tutor@python.org http://ma

Re: [Tutor] Delete file before function ends

2008-10-06 Thread Tim Golden
Adrian Greyling wrote: Not sure if this is possible, but I'll ask anyway. Below is a code snippet that creates my "problem"... What I'd like to do, is create a plain text file, use the associated program to open said textfile, (using os.startfile) and after the associated program has what it ne

[Tutor] Delete file before function ends

2008-10-06 Thread Adrian Greyling
Greetings all, Not sure if this is possible, but I'll ask anyway. Below is a code snippet that creates my "problem"... What I'd like to do, is create a plain text file, use the associated program to open said textfile, (using os.startfile) and after the associated program has what it needs to op

Re: [Tutor] IF Statements

2008-10-06 Thread Rajeev Nair
also i believe the first line can also be written as 'x = input('enter ...') instead of using x=int(raw_input('..') . use raw_input for string and just input for integer. regards rajeev On Mon, Oct 6, 2008 at 3:30 PM, <[EMAIL PROTECTED]> wrote: > Send Tutor mailing list submissions to

Re: [Tutor] IF statements

2008-10-06 Thread Kent Johnson
On Sun, Oct 5, 2008 at 10:51 PM, WM <[EMAIL PROTECTED]> wrote: > I used to do Basic and enjoyed it. Someone said Python was a vastly better > language than Visual Basic, which I considered playing with. So I sought to > give it a go but struck a sticking point very early. > I am now going through

Re: [Tutor] first call - newcomer

2008-10-06 Thread Alan Gauld
"Anthony Smith" <[EMAIL PROTECTED]> wrote This is my first post - I will be brief... Hi, welcome to tutor :-) 1. A brief (but complete) description regarding the use of script editor (I will be using command prompt in Windows), as: Brief and Complete don;t normally go together! If you ar

Re: [Tutor] IF statements

2008-10-06 Thread Alan Gauld
"WM" <[EMAIL PROTECTED]> wrote to IF. The code below was not written by me. It is a copy/paste job from the tutor. I do not have any idea what is going wrong. >>> x = int(raw_input("Please enter an integer: ")) Please enter an integer: 42 >>> if x < 0: ... x = 0 ... print 'Negati