[Tutor] Trivia program.

2005-02-16 Thread . Sm0kin'_Bull
Hi, I got a problem with this program.     name = raw_input("Hi. What's your name? ")called = name * 5print "\nIf a small child were trying to get your attention, " \   "your name would become:"print called When i input the name like "John Goodman"   it prints like...   John GoodmanJohn Goodman

[Tutor] Re: Basic terminology

2005-02-16 Thread Roel Schroeven
Bill Mill wrote: > However, where will it be pointing in 16 hours? Well, in 12 hours it > will be at the one, then four more hours later it will be pointing at > the five. This can be represented as: > > 1 + (16 % 12) = 1 + 4 = 5 Correcter is (1 + 16) % 12 = 17 % 12 = 5 > In general, the hour a

[Tutor] Re: Trivia program.

2005-02-16 Thread Wolfram Kraus
. Sm0kin'_Bull wrote: Hi, I got a problem with this program. name = raw_input("Hi. What's your name? ") called = name * 5 called = ' '.join([name]*5) print "\nIf a small child were trying to get your attention, " \ "your name would become:" print called When i input the name like "John G

Re: [Tutor] Trivia program.

2005-02-16 Thread Pierre Barbier de Reuille
Mmmhh ... one very simple way would be to replace your first line by : name = raw_input("Hi. What's your name? ") + " " But if you want to keep the name as it is, I bet the best way is to replace your second line by : called = " ".join([ name for i in xrange(5) ]) The advantage of this second m

Re: [Tutor] Trivia program.

2005-02-16 Thread Max Noel
On Feb 16, 2005, at 10:26, . Sm0kin'_Bull wrote: it prints like...   John GoodmanJohn GoodmanJohn GoodmanJohn GoodmanJohn Goodman   But i want to print it like...   John Goodman  John Goodman  John Goodman  John Goodman  John Goodman   How can I do it? Try replacing the called = name * 5 line w

Re: [Tutor] Trivia program.

2005-02-16 Thread Liam Clarke
Or name = raw_input("Hi. What's your name? ") called = "%s " % name On Wed, 16 Feb 2005 11:46:09 +0100, Pierre Barbier de Reuille <[EMAIL PROTECTED]> wrote: > Mmmhh ... one very simple way would be to replace your first line by : > > name = raw_input("Hi. What's your name? ") + " " > > But

Re: [Tutor] dictionary dispatch for object instance attributes question

2005-02-16 Thread Kent Johnson
Brian van den Broek wrote: My Node class defines a _parse method which separates out the node header, and sends those lines to a _parse_metadata method. This is where the elif chain occurs -- each line of the metadata starts with a tag like "dt=" and I need to recognize each tag and set the appr

Re: [Tutor] best way to scrape html

2005-02-16 Thread Kent Johnson
You might find these threads on comp.lang.python interesting: http://tinyurl.com/5zmpn http://tinyurl.com/6mxmb Peter Kim wrote: Which method is best and most pythonic to scrape text data with minimal formatting? I'm trying to read a large html file and strip out most of the markup, but leaving the

Re: [Tutor] dictionary dispatch for object instance attributes question

2005-02-16 Thread Kent Johnson
Kent Johnson wrote: Another way to do this is to use dispatch methods. If you have extra processing to do for each tag, this might be a good way to go. I'm going to assume that your data lines have the form 'tag=data'. Then your Node class might have methods that look like this: class Node: .

Re: [Tutor] Queued threads

2005-02-16 Thread Jeremy Jones
Not to beat a dead horse, but Liam Clarke wrote: Oops, you probably want to do this then- for i in range( 0, 3 ): oThread = Thread( target=mainFunction ).start() Thread.start() looks like it returns None. # In [23]: from threading import Thread In [24]: impo

[Tutor] Problem with variables

2005-02-16 Thread . Sm0kin'_Bull
 wrote this, It's a bit lame thoughI = "Allen"me = "Allen"my = "Allen's"print \"""%s woke up early in the morning. But, it was unusal by %s. %s pillowwas with %s. %s didn't want to wake up But, %s tried my best and woke up.it was so amazing!""" % (I,me,my,me,I,I)raw_input("\n\\t\t\t- The End -")Bu

[Tutor] Problems in making calulating program.

2005-02-16 Thread . Sm0kin'_Bull
I wrote this to add 2 numbers...print "Please input data"number1 = int(raw_input(" "))number2 = int(raw_input("+ "))total = number1 + number2print totalraw_input("")I want to make output like this...1 + 1 = 2But, actually... it looks like this...1+ 12  Express yourself instantly with MSN Messenger!

Re: [Tutor] Problem with variables

2005-02-16 Thread Jeremy Jones
. Sm0kin'_Bull wrote:  wrote this, It's a bit lame though I = "Allen" me = "Allen" my = "Allen's" print \ """ %s woke up early in the morning. But, it was unusal by %s. %s pillow was with %s. %s didn't want to wake up But, %s tried my best and woke up. it was so amazing!""" % (I,me,

Re: [Tutor] Re: Basic terminology

2005-02-16 Thread Bill Mill
On Wed, 16 Feb 2005 11:34:55 +0100, Roel Schroeven <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > However, where will it be pointing in 16 hours? Well, in 12 hours it > > will be at the one, then four more hours later it will be pointing at > > the five. This can be represented as: > > > > 1 + (

Re: [Tutor] Case acceptance using raw_input

2005-02-16 Thread Bob Gailer
At 11:40 PM 2/15/2005, Alan Gauld wrote: Is there a better way for raw_input to accept both caps and lower case letters than: def aFunction(): action = raw_input("Perform an action?(y,n): ") action = raw_input("Perform an action?(y,n): ").upper() if action == 'y' or action == 'Y':

Re: [Tutor] dictionary dispatch for object instance attributes question

2005-02-16 Thread Brian van den Broek
Kent Johnson said unto the world upon 2005-02-16 05:58: Brian van den Broek wrote: Also, I know the general security concerns about things like exec. They make me nervous in using it, even though I am (as yet) the sole user. Am I right in thinking that the constrained way I am using it here pro

Re: [Tutor] dictionary dispatch for object instance attributes question

2005-02-16 Thread Brian van den Broek
Brian van den Broek said unto the world upon 2005-02-16 14:04: Kent Johnson said unto the world upon 2005-02-16 05:58: if 'text' == self.document_type: self.do_text_stuff() if 'RTF' == self.document_type: self.do_RTF_stuff() Conditionals on a 'type' flag are a code smell that suggests using

Re: [Tutor] dictionary dispatch for object instance attributes question

2005-02-16 Thread Kent Johnson
Brian van den Broek wrote: As for the code smell thing, I have a follow-up question. I now get the point of the type-based conditional being a smell for classes. (I get it due to a previous thread that an over-enthusiastic inbox purge prevents me from citing with certainty, but I think it was Bi

Re: [Tutor] Queued threads

2005-02-16 Thread Jeff Shannon
On Wed, 16 Feb 2005 16:50:07 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > Oops, you probably want to do this then- > > for i in range( 0, 3 ): > oThread = Thread( target=mainFunction ).start() > > while oThread: > print 'sleeping 3 seconds' > time.sleep( 3 )

Re: [Tutor] dictionary dispatch for object instance attributes question

2005-02-16 Thread Jeff Shannon
On Tue, 15 Feb 2005 23:48:31 -0500, Brian van den Broek <[EMAIL PROTECTED]> wrote: > Jeff Shannon said unto the world upon 2005-02-15 21:20: > > On Tue, 15 Feb 2005 17:19:37 -0500, Brian van den Broek > > <[EMAIL PROTECTED]> wrote: > > > > For starters, I've made metadata a class attribute rather t

Re: ****SPAM(11.2)**** [Tutor] Larger program organization

2005-02-16 Thread Terry Carroll
On Fri, 11 Feb 2005, Bob Gailer wrote: > Whenever you find yourself writing an if statement ask whether this > would be better handled by subclasses. Whenever you find yourself about > to write a global statement, consider making the variables properties of > a class. Bob -- Brian already asked

[Tutor] Help needed with script to batch-create shapefiles

2005-02-16 Thread Chris Bromley
Dear all, I have several thousand files in dBaseIV format that I need to convert to shapefiles for use in ArcGIS. I've written a script (see below) to automate this process but thus far have been unable to get it to work. I suspect that there's a simple reason for this, but I'm a complete novi

Re: [Tutor] dictionary dispatch for object instance attributes question

2005-02-16 Thread Brian van den Broek
Kent Johnson said unto the world upon 2005-02-16 15:02: Brian van den Broek wrote: I had been thinking better to get everything working and then refactor. Is that an unsound approach? My worry about refactoring now is that I feel like I am rearranging deck-chairs when I should be worried about

Re: [Tutor] Help needed with script to batch-create shapefiles

2005-02-16 Thread Bill Mill
Chris, On Wed, 16 Feb 2005 21:37:10 +, Chris Bromley <[EMAIL PROTECTED]> wrote: > Dear all, > > I have several thousand files in dBaseIV format that I need to convert to > shapefiles for use in ArcGIS. I've written a script (see below) to automate > this process but thus far have been unab

Re: [Tutor] dictionary dispatch for object instance attributes question

2005-02-16 Thread Brian van den Broek
Jeff Shannon said unto the world upon 2005-02-16 16:09: On Tue, 15 Feb 2005 23:48:31 -0500, Brian van den Broek <[EMAIL PROTECTED]> wrote: Yes, if you know that you will only have one header per line, then it's reasonable to process them one line at a time. You could alternatively have the TP_f

Re: ****SPAM(11.2)**** [Tutor] Larger program organization

2005-02-16 Thread Brian van den Broek
Terry Carroll said unto the world upon 2005-02-16 16:18: On Fri, 11 Feb 2005, Bob Gailer wrote: Whenever you find yourself writing an if statement ask whether this would be better handled by subclasses. Whenever you find yourself about to write a global statement, consider making the variables pro

Re: [Tutor] Help needed with script to batch-create shapefiles

2005-02-16 Thread Liam Clarke
What are you getting? What are you expecting? Are you getting an error? If so, what's it telling you? Can you email this stuff up? I suspect you want to find the pywin documentation and go through that. Cheers, Liam Clarke On Wed, 16 Feb 2005 16:47:26 -0500, Bill Mill <[EMAIL PROTECTED]> wrot

Re: [Tutor] Help needed with script to batch-create shapefiles

2005-02-16 Thread Danny Yoo
On Wed, 16 Feb 2005, Bill Mill wrote: > > I have several thousand files in dBaseIV format that I need to convert > > to shapefiles for use in ArcGIS. I've written a script (see below) to > > automate this process but thus far have been unable to get it to work. > > I suspect that there's a simpl

Re: [Tutor] Help needed with script to batch-create shapefiles

2005-02-16 Thread Jeff Shannon
On Wed, 16 Feb 2005 21:37:10 +, Chris Bromley <[EMAIL PROTECTED]> wrote: > Any help would be greatly appreciated! Others have already pointed out that we will have a hard time helping without a bit more information. But I've noticed something odd in your code -- it probably doesn't have anyt

Re: [Tutor] Larger program organization

2005-02-16 Thread Kent Johnson
Terry Carroll wrote: On Fri, 11 Feb 2005, Bob Gailer wrote: Whenever you find yourself writing an if statement ask whether this would be better handled by subclasses. Whenever you find yourself about to write a global statement, consider making the variables properties of a class. Bob -- Brian

[Tutor] Active Python

2005-02-16 Thread Robert Campbell
Hi, I am not a programmer, but have decided to learn Python.  I am wondering if anyone has used the Activestate ActivePython and what are the advantages/disadvantages of using it rather than the standard Python tools.   Robert ___ Tutor maillist -

[Tutor] Reading/writing Wave files

2005-02-16 Thread Tony Cappellini
After looking at the Python docs for the wave module, I'm a bit puzzled as to how to use it. Does anyone have an example I can browse? If I write to a wave file, is the data I write actually audible, if I use Winamp or some other wave player, or is it more complicated than that? Is the data I w