Re: [Tutor] help with re module and parsing data

2011-03-07 Thread Steven D'Aprano
On Mon, 7 Mar 2011 06:54:30 pm vineeth wrote: Hello all I am doing some analysis on my trace file. I am finding the lines Recvd-Content and Published-Content. I am able to find those lines but the re module as predicted just gives the word that is being searched. But I require the entire line

Re: [Tutor] Help! (solution)

2011-03-05 Thread Alan Gauld
michael scott jigenbak...@yahoo.com wrote ...if something about my code could be better, please tell me, OK, Here are some stylistic things... def production_time(): creation_time = 127 time_till_rest = 18161 I'd move the constants out of the function to global level. And it is

Re: [Tutor] Help - want to display a number with two decimal places

2011-03-05 Thread Alan Gauld
Modulok modu...@gmail.com wrote However, to make all of your numbers line up nicely, regardless of how long they are, you need to look into advanced string formatting via the builtin string method 'format()'. It takes a little practice Or, if your version of Python doesn't support

Re: [Tutor] Help - want to display a number with two decimal places

2011-03-05 Thread Steven D'Aprano
Modulok wrote: Notice that 'd' in your string substitution means integers, not floats. Any decimal places will be truncated when using 'd'. For floats use 'f' instead. You an also specify a precision, such as '%.2f' shows two decimal places. However, to make all of your numbers line up nicely,

Re: [Tutor] Help! (solution)

2011-03-04 Thread michael scott
I know that the question has long been answered (and probably due today), but I solved it and it was great exercise for me (as I'm not in college at the moment and I need assignments like these to gauge my skills). I'll probably build a gui for it tomorrow, just so I can practice at that. I

Re: [Tutor] Help - want to display a number with two decimal places

2011-03-04 Thread Modulok
On 3/4/11, lea-par...@bigpond.com lea-par...@bigpond.com wrote: Hello I have created the following code but would like the program to include two decimal places in the amounts displayed to the user. How can I add this? My code: # Ask user to enter purchase price purchasePrice = input

Re: [Tutor] Help!

2011-03-03 Thread Knacktus
Am 03.03.2011 22:28, schrieb Andrew Bouchot: okay so this is my comp sci lab * Problem: *ProductionTime.py It takes exactly 2 minutes and 7 second to produce an item. Unfortunately, after 143 items are produced, the fabricator must cool off for 5 minutes and 13 seconds before it can continue.

Re: [Tutor] Help!

2011-03-03 Thread James Reynolds
This isn't so much as a python problem as it is a simple math problem, and I feel you are being lazy, but in the offchance you're having problems with the '/' operator: cooloff = (numitems/143)*313 total = cooloff + seconds I think you are using python 2.6 (and I guess 2.7) or older based on

Re: [Tutor] Help!

2011-03-03 Thread David Hutto
On Thu, Mar 3, 2011 at 4:56 PM, Knacktus knack...@googlemail.com wrote: Am 03.03.2011 22:28, schrieb Andrew Bouchot: okay so this is my comp sci lab * Problem: *ProductionTime.py It takes exactly 2 minutes and 7 second to produce an item. Unfortunately, after 143 items are produced, the

Re: [Tutor] Help!

2011-03-03 Thread Steven D'Aprano
James Reynolds wrote: [...] You are almost assuredly going to get flamed for not having a descriptive title and for asking what is obviously homework questions At least Andrew did the right thing by being honest that it was a homework question, and by showing the work he's done so far. But

Re: [Tutor] help

2011-02-24 Thread Nitin Pawar
instead of input ... use raw_input() On Thu, Feb 24, 2011 at 9:45 AM, Chris Schiro cschiro...@gmail.com wrote: Hi, I am completely new to programming aside from working with basic many years ago. I purchased a Python book for beginners so I could start from scratch which has been walking

Re: [Tutor] help

2011-02-24 Thread Noah Hall
I have found that this line will return an error every time while running the completed program, unless I enter a number. If I enter a numeric value the program will continue on as written. When it comes to things like error messages, you need to post enough code and the _exact_ error message

Re: [Tutor] help

2011-02-24 Thread Andre Engels
On Thu, Feb 24, 2011 at 5:15 AM, Chris Schiro cschiro...@gmail.com wrote: Hi, I am completely new to programming aside from working with basic many years ago. I purchased a Python book for beginners so I could start from scratch which has been walking me through just fine until: writing a

Re: [Tutor] help

2011-02-24 Thread عمـ نوفل ـاد
On 2/24/11, Chris Schiro cschiro...@gmail.com wrote: Hi, I am completely new to programming aside from working with basic many years ago. I purchased a Python book for beginners so I could start from scratch which has been walking me through just fine until: writing a program to interact

Re: [Tutor] help

2011-02-24 Thread Dipo Elegbede
That line only expects int and say numbers generally. If you want to print strings, use, raw_input in place of input. Try that out and then let's have a feedback. Sent from my BlackBerry wireless device from MTN On Thu, Feb 24, 2011 at 9:53 AM, Nitin Pawar nitinpawar...@gmail.comwrote: instead

Re: [Tutor] help

2011-02-24 Thread Alan Gauld
Chris Schiro cschiro...@gmail.com wrote I am completely new to programming aside from working with basic many years ago. I purchased a Python book for beginners so I could start from scratch which has been walking me through just fine until: writing a program to interact with user for

Re: [Tutor] help

2011-02-24 Thread Dipo Elegbede
i can mail free books on python 2. if you want. starting out with python 3.XXX restricts the amount of help you can get and also free resources. most resources i have come across are python 2.XXX. cheers. On Thu, Feb 24, 2011 at 9:58 AM, Andre Engels andreeng...@gmail.com wrote: On Thu, Feb

Re: [Tutor] help

2011-02-24 Thread bob gailer
Request: When posting a question use a meaningful subject line, as some of us track email by subject. -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread Walter Prins
On 24 February 2011 14:52, pyhx0r pyh...@gmail.com wrote: *Why do in my code, it loops to all values and not in Mark Pilgrim’s code? * Because in Mark's code the loop is terminated by the return statement (contained in the utility function approximate_size().) In your code you've removed the

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, pyhx0r wrote: Dear All, snip multiple = 1024 if a_kilobyte_is_1024_bytes else 1000 for suffix in SUFFIXES[multiple]: size /= multiple if size multiple: return '{0:.1f} {1}'.format(size, suffix) snip I’ve shorted the code

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread pyhx0r
Dear All, Thank you for your advise, it's helpful for me. NB: To DaveA, It was copy-paste from my notepad so the indentation went wrong :( +---+--+---+ | py | h | x0r | +---+--+---+ ■ 1 3 0 E2 C 9 ■ ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread Walter Prins
On 24 February 2011 16:22, Dave Angel da...@ieee.org wrote: (Is there a reason you double-spaced all that code? It makes it very hard to read, and quite difficult to quote, since I had to delete every other line.) For what it's worth the code came out perfectly fine on my email reader

Re: [Tutor] Help on Python Looping Please

2011-02-24 Thread Dave Angel
On 02/24/2011 11:55 AM, Walter Prins wrote: On 24 February 2011 16:22, Dave Angelda...@ieee.org wrote: (Is there a reason you double-spaced all that code? It makes it very hard to read, and quite difficult to quote, since I had to delete every other line.) For what it's worth the code

Re: [Tutor] Help with OCR

2011-02-07 Thread Alan Gauld
Sriram Jaju ramjaju.m...@gmail.com wrote I'm new to python. I'm doing a project on OCR (Optical Character Recognition), I've heard a lot about Python so i want to know whether i can use python for OCR. That depends a lot on the environment. What OS will you be using? What are you doing

Re: [Tutor] Help with OCR

2011-02-07 Thread Alan Gauld
Shashwat Anand anand.shash...@gmail.com wrote My another doubt is that, can i use python for programming microcontrollers You bet. Really? How would he go about that? I've not seen (or even heard of) Python used in that role before. Alan G

Re: [Tutor] Help with OCR

2011-02-07 Thread Sriram Jaju
I'm using windows7. I'm doing a robotic project in which a robot has to take instruction from images which are taken by camera. image consists of characters like 'START', 'STOP' etc. On Mon, Feb 7, 2011 at 2:25 PM, Alan Gauld alan.ga...@btinternet.comwrote: Sriram Jaju ramjaju.m...@gmail.com

Re: [Tutor] Help with OCR

2011-02-06 Thread Shashwat Anand
On Mon, Feb 7, 2011 at 1:13 PM, Sriram Jaju ramjaju.m...@gmail.com wrote: Hi all, I'm new to python. I'm doing a project on OCR (Optical Character Recognition), I've heard a lot about Python so i want to know whether i can use python for OCR. If yes what are the tool require for that?.

Re: [Tutor] Help with range of months spanning across years

2011-02-02 Thread Steven D'Aprano
ian douglas wrote: It bugs me that so many people are quick to jump on the we wont' do your homework bandwagon -- I was accused of the same thing when I posted a question to the list myself. I've been programming professionally for many years but learning Python in my spare time... I sent

Re: [Tutor] Help with range of months [was Tutor Digest, Vol 84, Issue 8]

2011-02-02 Thread Steven D'Aprano
Hi Nevins, I don't think I've seen you post here before. Welcome to the list! Before answering your comment (see below), I have to give you a gentle wrap on the knuckles. It's considered impolite to: (1) reply to a digest without changing the subject line from Tutor Digest to something more

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Hugo Arts
On Wed, Feb 2, 2011 at 12:19 AM, Sean Carolan scaro...@gmail.com wrote: I have a function that accepts four arguments, namely startmonth, startyear, endmonth, and endyear.  For example: startmonth = 8 startyear = 2009 endmonth = 1 endyear = 2010 What would be the most straightforward way

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Alan Gauld
Hugo Arts hugo.yo...@gmail.com wrote What would be the most straightforward way to create a list of year/month pairs from start to end? I want to end up with a list of tuples like this: mylist = [(2009, 8), (2009, 9), (2009, 10), (2009, 11), (2009, 12), (2010, 1)] That said, you can do

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Elwin Estle
--- On Tue, 2/1/11, Sean Carolan scaro...@gmail.com wrote: From: Sean Carolan scaro...@gmail.com Subject: [Tutor] Help with range of months spanning across years To: Tutor@python.org Date: Tuesday, February 1, 2011, 6:19 PM I have a function that accepts four arguments, namely startmonth,

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread ian douglas
It bugs me that so many people are quick to jump on the we wont' do your homework bandwagon -- I was accused of the same thing when I posted a question to the list myself. I've been programming professionally for many years but learning Python in my spare time... I sent this reply to Sean

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Sean Carolan
This sounds somewhat like homework. If it is, that's fine, mention it, and we will help you. But we won't do your homework for you, so keep that in mind. A reasonable assumption but this is actually going in a cgi tool that I'm using at work. The input comes from pull-down menus on a web

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Hugo Arts
On Wed, Feb 2, 2011 at 2:30 AM, ian douglas ian.doug...@iandouglas.com wrote: It bugs me that so many people are quick to jump on the we wont' do your homework bandwagon -- I was accused of the same thing when I posted a question to the list myself. I've been programming professionally for many

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Hugo Arts
On Wed, Feb 2, 2011 at 2:55 AM, Sean Carolan scaro...@gmail.com wrote: This sounds somewhat like homework. If it is, that's fine, mention it, and we will help you. But we won't do your homework for you, so keep that in mind. A reasonable assumption but this is actually going in a cgi tool

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Sean Carolan
As far as I can tell from quickly going through documentation, no. At least, not with a quick and easy function. datetime can represent the dates just fine, and you can add days to that until you hit your end date, but adding months is harder. timedelta can't represent a month, which makes

Re: [Tutor] Help listing directory timestamps and deleting directories

2011-01-24 Thread Vince Spicer
On Mon, Jan 24, 2011 at 11:25 AM, bsd...@gmail.com bsd...@gmail.com wrote: Hi, hoping for some help here. I've been trying to write a python script (complete newb) and have spent several days trying to get this right with no success. I am trying to list timestamps in a directory and if they

Re: [Tutor] Help listing directory timestamps and deleting directories

2011-01-24 Thread Japhy Bartlett
I would check that os.path.join(r,dir) is giving you the directory you think it is. - japhy On Mon, Jan 24, 2011 at 12:25 PM, bsd...@gmail.com bsd...@gmail.com wrote: Hi, hoping for some help here. I've been trying to write a python script (complete newb) and have spent several days trying to

Re: [Tutor] Help listing directory timestamps and deleting directories

2011-01-24 Thread Karim
Hello, Also working w/o external module just the standard one: * import datetime remove_after = datetime.datetime.now() - datetime.timedelta(days=31) remove_after datetime.datetime(2010, 12, 24, 23, 21, 10, 11315) * Regards Karim On 01/24/2011 08:02 PM, Vince Spicer wrote: On Mon, Jan

Re: [Tutor] Help on RE

2011-01-23 Thread Japhy Bartlett
it's a bug in your regex - you want something like -?\d+ - japhy On Sat, Jan 22, 2011 at 7:38 PM, tee chwee liong tc...@hotmail.com wrote: hi, i have a set of data and using re to extract it into array. however i only get positive value, how to extract the whole value including the -ve sign?

Re: [Tutor] Help on RE

2011-01-23 Thread Albert-Jan Roskam
health, what have the Romans ever done for us? ~~ From: Steven D'Aprano st...@pearwood.info To: tutor@python.org Sent: Sun, January 23, 2011 4:10:35 AM Subject: Re: [Tutor] Help on RE tee chwee

Re: [Tutor] Help on RE

2011-01-22 Thread tee chwee liong
thanks it works!! :) Date: Sat, 22 Jan 2011 19:51:35 -0500 Subject: Re: [Tutor] Help on RE From: ja...@pearachute.com To: tc...@hotmail.com CC: tutor@python.org it's a bug in your regex - you want something like -?\d+ - japhy On Sat, Jan 22, 2011 at 7:38 PM, tee chwee liong tc

Re: [Tutor] Help on RE

2011-01-22 Thread tee chwee liong
thanks for making me understand more on re. re is a confusing topic as i'm starting on python. Date: Sat, 22 Jan 2011 16:55:37 -0800 From: st...@alchemy.com To: tc...@hotmail.com CC: tutor@python.org Subject: Re: [Tutor] Help on RE On Sun, Jan 23, 2011 at 12:38:10AM +, tee chwee

Re: [Tutor] Help on RE

2011-01-22 Thread Steve Willoughby
On Sun, Jan 23, 2011 at 12:38:10AM +, tee chwee liong wrote: i have a set of data and using re to extract it into array. however i only get positive value, how to extract the whole value including the -ve sign? numbers = re.findall(\d+, line) The \d matches a digit character. \d+

Re: [Tutor] Help on RE

2011-01-22 Thread Steven D'Aprano
tee chwee liong wrote: thanks for making me understand more on re. re is a confusing topic as i'm starting on python. I quote the great Jamie Zawinski, a world-class programmer and hacker: Some people, when confronted with a problem, think 'I know, I'll use regular expressions. Now

Re: [Tutor] Help on RE

2011-01-22 Thread tee chwee liong
elegant. :) simple yet elegant. Date: Sun, 23 Jan 2011 14:10:35 +1100 From: st...@pearwood.info To: tutor@python.org Subject: Re: [Tutor] Help on RE tee chwee liong wrote: thanks for making me understand more on re. re is a confusing topic as i'm starting on python. I quote

Re: [Tutor] help

2011-01-15 Thread Alan Gauld
walter weston hacker0...@hotmail.com wrote how comes when I run code from a new window in python IDLE the text highlighting dissapears No idea, it doesn't do that for me. Can you be more specific about what you are doing. Also which version of Python, which OS etc? How exactly are you

Re: [Tutor] Help with using the ctypes module

2010-12-13 Thread Luke Paireepinart
I confess I don't know a lot about C so I may be off base here... But it looks like your c func extendarray returns a pointer to the new extended array, but you are not capturing this pointer in your python when you call the c func. So the python code is pointing at the old deallocated array.

Re: [Tutor] Help regarding lists, dictionaries and tuples (bob gailer)

2010-11-24 Thread Alan Gauld
Robert Sjöblom robert.sjob...@gmail.com wrote Why would you want to sum them? You start with 30 points in the pool, then allocate them to the attributes. The sum will still be 30. Because the user should be able to spend 30 points, or remove points from an attribute and get them back in the

Re: [Tutor] Help regarding lists, dictionaries and tuples (bob gailer)

2010-11-23 Thread Robert Sjöblom
On Mon, Nov 22, 2010 at 10:27 AM, tutor-requ...@python.org wrote: Send Tutor mailing list submissions to        tu...@python.org [snip] Ok, I'm clearly thinking in circles here. I used the interpreter to figure out that both are fine but the first example has integers, whereas the second

Re: [Tutor] Help regarding lists, dictionaries and tuples

2010-11-21 Thread Hugo Arts
On Mon, Nov 22, 2010 at 12:29 AM, Robert Sjöblom robert.sjob...@gmail.com wrote: Hi. I'm new at programming and, as some others on this list, am going through Python Programming for the Absolute Beginner. In the current chapter (dealing with lists and dictionaries), one of the challenges is

Re: [Tutor] Help regarding lists, dictionaries and tuples

2010-11-21 Thread Robert Sjöblom
[Snip] I don't want a direct answer on how to proceed, but a question that arose during my thinking of the problem was whether dictionaries can have integral data in them, like so: attributes = {Strength : 28, Health : 12} or if they have to be: attributes = {Strength : 28, Health : 12}

Re: [Tutor] Help regarding lists, dictionaries and tuples

2010-11-21 Thread bob gailer
On 11/21/2010 6:29 PM, Robert Sjöblom wrote: Hi. I'm new at programming and, as some others on this list, am going through Python Programming for the Absolute Beginner. In the current chapter (dealing with lists and dictionaries), one of the challenges is to: Write a Character Creator program

Re: [Tutor] Help installing HLS Player

2010-10-11 Thread Wayne Werner
On Mon, Oct 11, 2010 at 6:56 AM, p4ddy prdpsb...@gmail.com wrote: Hi, I have a HLS Player written in python but whenever I try to install it, I get this error ImportError: No module named setuptools So I downloaded setuptools-0.6c11.zip and tried to install it, again i got this error

Re: [Tutor] Help - server health check reporter

2010-09-30 Thread Steven D'Aprano
On Fri, 1 Oct 2010 09:26:16 am Russell Smith wrote: I’m trying to put together a script using urllib2, smtplib and stripogram/html2text which will use a healthcheck url, read the response after loading it and then email me the results without any unwanted html tags. I was able to do that but,

Re: [Tutor] Help-Embedding Python in C#

2010-09-23 Thread Steven D'Aprano
On Thu, 23 Sep 2010 03:17:39 pm ranjan das wrote: What I want to do is write my code completely in Python (as gainst iron python), Iron Python *is* Python. It's just a different implementation, with built-in support for Dot-Net. copy it to the visual studio editor and create a web based

Re: [Tutor] Help-Embedding Python in C#

2010-09-22 Thread Wayne Werner
On Wed, Sep 22, 2010 at 7:55 AM, ranjan das ranjand2...@gmail.com wrote: Please Advise: I need to run/execute python module in C#. I am using python 2.6 and visual studio 10 You should check out IronPython http://www.ironpython.com/ http://www.ironpython.com/HTH, Wayne

Re: [Tutor] Help-Embedding Python in C#

2010-09-22 Thread ranjan das
Hi Wayne, Thanks for your reply. The problem is a bit more specific. I have come across ironpython and I ran a test file and it works fine as far as the wrapping is concerned. What I want to do is write my code completely in Python (as gainst iron python), copy it to the visual studio editor and

Re: [Tutor] Help - importing modules

2010-09-18 Thread Joel Goldstick
On Sat, Sep 18, 2010 at 10:16 AM, Fernando Karpinski fanger2...@gmail.comwrote: Hi, everyone. I need help when importing a file I created, with the .py extension. I am trying to access its directory in DOS, and after I do it, I type import filename, but it is not working. I tried to do it

Re: [Tutor] Help - importing modules

2010-09-18 Thread Steven D'Aprano
On Sun, 19 Sep 2010 12:16:47 am Fernando Karpinski wrote: Hi, everyone. I need help when importing a file I created, with the .py extension. I am trying to access its directory in DOS, and after I do it, I type import filename, but it is not working. Define not working. My crystal ball

Re: [Tutor] Help - importing modules

2010-09-18 Thread David Hutto
On Sat, Sep 18, 2010 at 11:46 AM, Steven D'Aprano st...@pearwood.info wrote: On Sun, 19 Sep 2010 12:16:47 am Fernando Karpinski wrote:    Hi, everyone. I need help when importing a file I created, with the .py extension. I am trying to access its directory in DOS, and after I do it, I type

Re: [Tutor] help with integers

2010-09-14 Thread Joel Goldstick
On Tue, Sep 14, 2010 at 8:00 PM, Ciera Jones cjo1...@gmail.com wrote: Hi When I enter myvar= raw_input (Please excuse a number of movies: ) and I try and convert it to an integer it gives me an error message. I put in: movietotal= int(myvar)* 3 and I get an error message Ciera post your

Re: [Tutor] help with integers

2010-09-14 Thread Alan Gauld
Ciera Jones cjo1...@gmail.com wrote When I enter myvar= raw_input (Please excuse a number of movies: ) and I try and convert it to an integer it gives me an error message. I put in: movietotal= int(myvar)* 3 and I get an error message Don't put quotes around the variable name. Python is

Re: [Tutor] Help with Object Oriented Programming

2010-08-31 Thread Tino Dai
On Mon, Aug 30, 2010 at 2:26 PM, Serdar Tumgoren tumgor...@washpost.com wrote: I haven't read it yet myself, but the below book just came out: http://www.amazon.com/Python-3-Object-Oriented-Programming/dp/1849511268/ref=cm_cr_pr_sims_t I'm not aware of any other book that focuses exclusively

Re: [Tutor] Help with Object Oriented Programming

2010-08-31 Thread Tino Dai
On Mon, Aug 30, 2010 at 3:21 PM, Alan Gauld alan.ga...@btinternet.com wrote: Tino Dai obe...@gmail.com wrote      I'm beefing up my Object-Oriented Analysis and Design - getting the gaps in my knowledge filled in through the Head First OOAD book I don't know it although I've seen a couple

Re: [Tutor] Help with Object Oriented Programming

2010-08-31 Thread Tino Dai
On Mon, Aug 30, 2010 at 2:59 PM, Knacktus knack...@googlemail.com wrote: You could google for 1) Alex Martelli, Design Patterns He's a Pyton guru and there're some online talks (at Google and some conferences) about DP; a bit difficult to understand, well, he's guru ;-) 2)

Re: [Tutor] Help with Object Oriented Programming

2010-08-31 Thread Albert-Jan Roskam
To: Alan Gauld alan.ga...@btinternet.com Cc: tutor@python.org Sent: Tue, August 31, 2010 3:43:57 PM Subject: Re: [Tutor] Help with Object Oriented Programming On Mon, Aug 30, 2010 at 3:21 PM, Alan Gauld alan.ga...@btinternet.com wrote: Tino Dai obe...@gmail.com wrote I'm beefing up my Object

Re: [Tutor] Help with Object Oriented Programming

2010-08-30 Thread Serdar Tumgoren
I haven't read it yet myself, but the below book just came out: http://www.amazon.com/Python-3-Object-Oriented-Programming/dp/1849511268/ref=cm_cr_pr_sims_t I'm not aware of any other book that focuses exclusively on OO in Python, though you'll find good intros to the topic in a number of the

Re: [Tutor] Help with Object Oriented Programming

2010-08-30 Thread Knacktus
Am 30.08.2010 20:13, schrieb Tino Dai: Hi Everybody, I'm beefing up my Object-Oriented Analysis and Design - getting the gaps in my knowledge filled in through the Head First OOAD book (http://headfirstlabs.com/books/hfooad/). That book focuses on Java - is there a comparable book for

Re: [Tutor] Help with Object Oriented Programming

2010-08-30 Thread Knacktus
You could google for 1) Alex Martelli, Design Patterns He's a Pyton guru and there're some online talks (at Google and some conferences) about DP; a bit difficult to understand, well, he's guru ;-) 2) http://www.suttoncourtenay.org.uk/duncan/accu/pythonpatterns.html I like that one. Also,

Re: [Tutor] Help with Object Oriented Programming

2010-08-30 Thread Alan Gauld
Tino Dai obe...@gmail.com wrote I'm beefing up my Object-Oriented Analysis and Design - getting the gaps in my knowledge filled in through the Head First OOAD book I don't know it although I've seen a couple of others in the series. My recommendations for general OOAD books are:

Re: [Tutor] help, complete beginner please!

2010-08-28 Thread Alan Gauld
kevin hayes kevino...@gmail.com wrote Hi all! I'm trying to write a basic text adventure game to start learning python (just for fun). I've gone through the first four chapters of a learn python game programming book and I'm having trouble with the exercise on writing a text adventure.

Re: [Tutor] help, complete beginner please! CORRECTION

2010-08-28 Thread bob gailer
Thanks to Luke for pointing out that Room1() did not return anything. I now add a return statement: 9) have the functions return text rather than printing it. Use triple quoted text. e.g.: def Room1(): description = You find yourself in a large room. Above you is a massive crystal

Re: [Tutor] help, complete beginner please!

2010-08-27 Thread aug dawg
Now, I'm no pro at programming in Python, but here's what I recommend you do. I would have a class at the beginning to define all of the rooms, and then have the rest of the code below that. Then, it makes it easier to follow. In addition, I would also have a function that stores the name of the

Re: [Tutor] help, complete beginner please!

2010-08-27 Thread bob gailer
On 8/27/2010 9:42 PM, kevin hayes wrote: Hi all! I'm trying to write a basic text adventure game to start learning python (just for fun). I've gone through the first four chapters of a learn python game programming book and I'm having trouble with the exercise on writing a text adventure.

Re: [Tutor] Help with Import Error problems

2010-08-01 Thread Evert Rol
Hi. Good day. I am having an import error problem. Last week, I was following this site: http://sites.google.com/site/spatialpython/processing-aster-with-python-numpy-and-gdal. I was able to make the python script run on the terminal. But this week, it was throwing some error. This

Re: [Tutor] Help with Import Error problems

2010-08-01 Thread Roy Khristopher Bayot
Evert, I got it back working. But it was with some stroke of luck. And I dont know the explanation. I installed the latest source of GEOS (as suggested by someone from the gdal channel). Then i tried the script. It gave me a different import error. ImportError: libgeos-3.3.0.so: cannot open

Re: [Tutor] Help with Import Error problems

2010-08-01 Thread Evert Rol
I got it back working. But it was with some stroke of luck. And I dont know the explanation. I installed the latest source of GEOS (as suggested by someone from the gdal channel). Then i tried the script. It gave me a different import error. ImportError: libgeos-3.3.0.so: cannot open

Re: [Tutor] Help with Import Error problems

2010-08-01 Thread Roy Khristopher Bayot
Evert, Thank you very much. I do hope it goes on working. :D Roy On Mon, Aug 2, 2010 at 2:09 AM, Evert Rol evert@gmail.com wrote: I got it back working. But it was with some stroke of luck. And I dont know the explanation. I installed the latest source of GEOS (as suggested by

Re: [Tutor] Help with Hangman program

2010-07-19 Thread Alan Gauld
John Palmer speederpyt...@gmail.com wrote I have the program working nearly as I want it to be. The only problem is, that when the user is prompted to enter its chosen word, (I am using a raw input) and the word is typed in, it shows in the line above, Take a look at the getpass module.

Re: [Tutor] Help with hangman

2010-07-19 Thread Alan Gauld
John Palmer speederpyt...@gmail.com wrote Modifying the subject... And I repeat, please don't send the whole digest, delete the excess irrelevant stuff! (see below!) Thanks a lot for the help guys, but when I use the getpass.getpass(Enter your word here, I get a different response to what you

Re: [Tutor] Help

2010-07-14 Thread Andre Engels
On Tue, Jul 13, 2010 at 12:34 PM, Nitin Pawar nitinpawar...@gmail.com wrote: Adding to what Andre said, another way of optimizing the problem would be storing the prime number in the range you want to check an array and see if the given number is divisible by any of those prime number As I

Re: [Tutor] Help execution time calculation:

2010-07-14 Thread Steven D'Aprano
On Thu, 15 Jul 2010 01:11:58 am Vineeth Rakesh wrote: Hello all, I want to calculate the execution time of a program. Say I have a function like below: def RepAdd(i): j = 0 while(ji): j += 1 return j now I want to calculate the execution time of the function RepAdd when say

Re: [Tutor] Help

2010-07-13 Thread Nitin Pawar
Hi, You have two different problems 1) Easiest algorithm to find a prime number 2) and then coding the algorithm By my knowledge,The Sieve of Eratosthenes algorithm is the fastest to find a prime number. The algorithm works on the basis that if a number n is prime, then all multiples of it are

Re: [Tutor] Help

2010-07-13 Thread Andre Engels
On Tue, Jul 13, 2010 at 11:50 AM, Dipo Elegbede delegb...@dudupay.com wrote: I was trying to write a code that prints prime numbers between 1 and 20. I have by myself seen that something is wrong with my code and also my brain. Could anyone be kind enough to tell me what to do Where I

Re: [Tutor] Help

2010-07-13 Thread Nitin Pawar
Adding to what Andre said, another way of optimizing the problem would be storing the prime number in the range you want to check an array and see if the given number is divisible by any of those prime number This improves the performance. Thanks, nitin On Tue, Jul 13, 2010 at 3:52 PM, Andre

Re: [Tutor] Help

2010-07-13 Thread Dave Angel
Dipo Elegbede wrote: I was trying to write a code that prints prime numbers between 1 and 20. I have by myself seen that something is wrong with my code and also my brain. Could anyone be kind enough to tell me what to do Where I am confused is how to test for other numbers without one

Re: [Tutor] Help

2010-07-13 Thread bob gailer
You have gotten good advice from others. My request is that you provide a meaningful subject when you post a question. We track by subject. Help is not the best subject. Better would be How to find prime numbers -- Bob Gailer 919-636-4239 Chapel Hill NC

Re: [Tutor] Help

2010-07-13 Thread bob gailer
On 7/13/2010 5:50 AM, Dipo Elegbede wrote: I was trying to write a code that prints prime numbers between 1 and 20. Other suggestions - you need only test divisors up to the square root of the candidate. - you can easily eliminate all even numbers and numbers divisible by 3. for i in

Re: [Tutor] Help

2010-07-13 Thread Shashwat Anand
On Tue, Jul 13, 2010 at 3:20 PM, Dipo Elegbede delegb...@dudupay.comwrote: I was trying to write a code that prints prime numbers between 1 and 20. I have by myself seen that something is wrong with my code and also my brain. Could anyone be kind enough to tell me what to do Where I

Re: [Tutor] Help return a pattern from list

2010-07-05 Thread Sander Sweers
On 5 July 2010 19:54, Vineeth Rakesh vineethrak...@gmail.com wrote: Can some one help me to return a special pattern from a list. say list = [something1.mp3,something2.mp3,something4.pdf,something5.odt] now say I just need to return the files with .mp3 extension. How to go about doing this?

Re: [Tutor] Help return a pattern from list

2010-07-05 Thread Shashwat Anand
On Mon, Jul 5, 2010 at 11:24 PM, Vineeth Rakesh vineethrak...@gmail.comwrote: Hello all, Can some one help me to return a special pattern from a list. say list = [something1.mp3,something2.mp3,something4.pdf,something5.odt] One suggestion. Don't name a list as list. Use l or List or any

Re: [Tutor] Help return a pattern from list

2010-07-05 Thread Shashwat Anand
On Mon, Jul 5, 2010 at 11:58 PM, Shashwat Anand anand.shash...@gmail.comwrote: On Mon, Jul 5, 2010 at 11:24 PM, Vineeth Rakesh vineethrak...@gmail.comwrote: Hello all, Can some one help me to return a special pattern from a list. say list =

Re: [Tutor] Help return a pattern from list

2010-07-05 Thread Alan Gauld
Shashwat Anand anand.shash...@gmail.com wrote list = [something1.mp3,something2.mp3,something4.pdf,something5.odt] [i for i in list if i[-4:] == '.mp3'] ['something1.mp3', 'something2.mp3'] Or even easier: [s for s in list if s.endswith('.mp3')] But for the specific case of file

Re: [Tutor] Help return a pattern from list

2010-07-05 Thread Thomas C. Hicks
On Mon, 05 Jul 2010 20:29:02 +0200 tutor-requ...@python.org wrote: Date: Mon, 5 Jul 2010 13:54:55 -0400 From: Vineeth Rakesh vineethrak...@gmail.com To: tutor@python.org Subject: [Tutor] Help return a pattern from list Message-ID:

Re: [Tutor] Help return a pattern from list

2010-07-05 Thread Emile van Sebille
On 7/5/2010 4:19 PM Alan Gauld said... But for the specific case of file extensions the os.path.splitext() is a better solution. If, as the names suggest, the source is the file system, then I'd reach for glob. Emile ___ Tutor maillist -

Re: [Tutor] Help with choices for new database program

2010-07-04 Thread Jeff Johnson
On 07/03/2010 08:25 AM, Jim Byrnes wrote: Jeff Johnson wrote: On 07/02/2010 11:40 AM, Chris C. wrote: I'm writing this question because I want, for my own satisfaction, to rewrite one of my Access dbs (one that does our finances) into a stand-alone Python database program using SQLite. I know

Re: [Tutor] Help with exercises from learning to program python wikibooks

2010-07-04 Thread Hugo Arts
On Sun, Jul 4, 2010 at 3:20 PM, John Palmer speederpyt...@gmail.com wrote: Hi I've just decided to try an learn python but i'm already stuck on one of the first exercises, i've given the link below: http://en.wikibooks.org/wiki/Python_Programming/Creating_Python_programs The exercise that

Re: [Tutor] Help with exercises from learning to program pythonwikibooks

2010-07-04 Thread Alan Gauld
John Palmer speederpyt...@gmail.com wrote I've looked at the solution but it appears not to be working when i use this code File hello.py, line 1 print (Hello, , end= ) ^ SyntaxError: invalid syntax This is Python V3 syntax, I suspect you have Python v2

<    4   5   6   7   8   9   10   11   12   13   >