[Tutor] Class reference problem?

2005-06-03 Thread [EMAIL PROTECTED]
for item in function1(args): object = class() if (function2(item)): if (condition): object.variable = value object.function() print object # debug print object #debug The above pseudo code (not really, but close enough) is essentially

Re: [Tutor] Class reference problem?

2005-06-03 Thread [EMAIL PROTECTED]
> Hmmm... you may want to modify the print statements slightly to make > it more clear which of the two print statements are being displayed. > As the code stands, it's not clear that 'condition' is ever set to true. /me slaps himself in the forehead. After modifying the print statements as s

Re: [Tutor] Numbers & Characters As Dictionary Keys

2005-06-21 Thread [EMAIL PROTECTED]
-- Original Message - Subject: Re: [Tutor] Numbers & Characters As Dictionary Keys Date: Tue, 21 Jun 2005 17:47:41 +0100 From: "Alan G" <[EMAIL PROTECTED]> To: "Don Parris" <[EMAIL PROTECTED]>, "Python Tutor List" >

[Tutor] The new iMesh

2005-08-05 Thread [EMAIL PROTECTED]
      tutor@python.org, I'd like to invite you to try the new iMesh! iMesh 5 lets you search and download music, videos, images and more. The Professional version is now FREE. It's also 100% clean. NO POPUPS, NO SPYWARE and NO ADWARE. iMesh 5 lets you con

[Tutor] (no subject)

2007-07-13 Thread [EMAIL PROTECTED]
Hello, The attached code makes a number of colored rectangles visible in a canvas. Each rectangle should match with a pre-recorded sound file (in .wav or other format) containing the pronunciation of a letter of the alphabet in a given language. For instance, the first rectangle, in white,

Re: [Tutor] scite with python 2.51

2007-09-23 Thread [EMAIL PROTECTED]
> how do I set up scite editor with python so that I can click check > syntax and compile from the editor? You just need to setup your environment's PATH so that it knows where to find python. This probably means you need to add "C:/python25" to your path. Once you do this, restart scite, and it

Re: [Tutor] IDE - Editors - Python

2006-02-10 Thread [EMAIL PROTECTED]
What about It's an Editor based on wxPython. NewEdit uses Mixin and Plugin technique as its architecture. Most of its classes can be extended via mixin and plugin components, and finally become an integrity class at creating the instance. So NewEdit is very dynamic. You can write the new featur

[Tutor] how to test .mov file using python

2006-11-01 Thread [EMAIL PROTECTED]
I know that python has many packages such as nose, which is for testing. Now I am going to test a quicktime file to find out if it works properly. Are there an existing python package could do that? And how to write the program? Thanks, Yi ___ Tutor mail

Re: [Tutor] how to test .mov file using python

2006-11-01 Thread [EMAIL PROTECTED]
Andreas, Thank you very much for your reply. "Using mplayer to test if the video track decodes" sounds like a good idea. I am a new python user. Could you please talk more details about how to do that. Thanks again, YiOn 11/1/06, Andreas Kostyrka <[EMAIL PROTECTED]> wrote:

[Tutor] Python for Kids

2006-11-28 Thread [EMAIL PROTECTED]
Hello, I bought the book "Python for Kids". started to read it, but can not find where I have to install xturlte? I use macintosh... Have python 2.5. If someone knows where I have to copy the xturtle and other files (for xturle) on macintosh, will be happy for help:) Thank You in advance, V

[Tutor] Program Control

2007-02-08 Thread [EMAIL PROTECTED]
I am learning Python and have written several small programs of increasing complexity but so far they are all "linear" programs meaning that they are meant to do one thing. I have yet to fully understand program control in order to go to and return form modules (I think this is the correct term).

Re: [Tutor] Program Control

2007-02-08 Thread [EMAIL PROTECTED]
tions. The term module may be incorrect here. I would like to have all of my code in one program but be able to call sections of code and return from them to the main app. That's where I'm lost. On 2/8/07, Kent Johnson <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: > I a

[Tutor] Random Number Randrange

2007-02-12 Thread [EMAIL PROTECTED]
When I use the function random.randrange(x,y) I never get the upper limit y in the list. I've tried the range 1,3 and never get 3. If I choose 1,4 I get 3 but never 4. Is the upperlimit actually ___ Tutor maillist - Tutor@python.org http://mail.pyt

[Tutor] User Input List and Sort

2007-02-14 Thread [EMAIL PROTECTED]
Every example of a list that I've seen involves working with, sorting, etc pre-populated list. How can I create a list where the user inputs a string of numbers and then sorts it? I've tried: print "Input list separated by commas" lst=[raw_input()] print lst print len(lst) lst.sort() print lst

[Tutor] Error when calling a class

2007-02-18 Thread [EMAIL PROTECTED]
I'm learning about creating classes and have created the simple class below: class Temperature (object): def fahrenheit(self): return 32 + (1.8 * self.celsius) d = Temperature() d.celsius = float(input()) print d.fahrenheit() This works fine stand-alone but I can't get it to wor

Re: [Tutor] Main program confusion

2007-02-19 Thread [EMAIL PROTECTED]
It's wxpython demo's code. It's necessary to have the run.py in the same path, to make it run, and usually also some other files. -- Tom, http://www.vscripts.net > I've never heard of this module. Where did this code come from? ___ Tutor maillist -

Re: [Tutor] origin of the name python

2007-02-27 Thread [EMAIL PROTECTED]
Monty Python: http://en.wikipedia.org/wiki/Monty_python I believe full story is somewhere on python.org website. -- Cheers, Tom http://www.vscripts.net ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] (no subject)

2008-05-28 Thread [EMAIL PROTECTED]
Hello, (Sorry if this message gets double posted) I have been looking at using Beautifulsoup python module to make changes to some static html files a total of 167 files, but being a newb in programming was wondering first how to open, read/process the file, then write it, close it and then ope

[Tutor] Example of modifying files in directory

2008-05-28 Thread [EMAIL PROTECTED]
Hello, I have been looking at using Beautifulsoup python module to make changes to some static html files a total of 167 files, but being a newb in programming was wondering first how to open, read/process the file, then write it, close it and then open the next file thus creating the loop. Ca

[Tutor] Modifying files in a directory.

2008-05-29 Thread [EMAIL PROTECTED]
Hi, >From my previous post, I have tis so far: [code] import os from BeautifulSoup import BeautifulSoup rootdir='/home/david/test' def upDateTable(line): soup = BeautifulSoup(''.join(file)) return line for subdir, dirs, files in os.walk(rootdir): for file in files: f=

Re: [Tutor] Modifying files in a directory.

2008-05-29 Thread [EMAIL PROTECTED]
ok, but looking at the docs isn't BeautifulStoneSoup an XML parser or am I missing something? David Guard against online ID theft - http://www.tiscali.co.uk/spyguard___ Tutor maillist - Tutor@python.org http://mail.python.org

Re: [Tutor] Modifying files in a directory.

2008-05-29 Thread [EMAIL PROTECTED]
Hi Yes I did notice I don't pass anything in the upDateTable ;) My problem is having to understand how to actually do this recursively On the command line seems simple and I get: >>> from BeautifulSoup import BeautifulSoup >>> path = '/home/david/test/stack.html' >>> path '/home/david/test/stack.

Re: [Tutor] Modifying files in a directory.

2008-05-30 Thread [EMAIL PROTECTED]
Hello, Thanks for the replies, I have now installed ipython and will take the time to explore each object further. But I have one more question. On each page I have several From $32.66 each with different price. so, changing the code to use the findAll, returns a list: >>> otp = soup.findAl

Re: [Tutor] Modifying files in a directory.

2008-05-30 Thread [EMAIL PROTECTED]
Yes I do need to learn the basics of programming ;) This was the first I did, was to put the modification code into the loop, but had this error: >>> for x in otp: ... price = float(x.contents[1].lstrip(' $')) ... x.contents[1].replaceWith('$%0.2f' % (price * 0.85)) ... Traceback (most

Re: [Tutor] Modifying files in a directory.

2008-05-30 Thread [EMAIL PROTECTED]
OK I see, >>> for x in otp: ... print x ... From$23.60 $79.99 $39.99 1 Blister Pack - $65.95 So I will need to use the Remove elements in my code. Thanks for all your help. David Guard your email - http://www.tiscali.co.uk/products/securemail/ _

[Tutor] TypeError: argument 1 must be string or read-only character buffer, not instance

2008-06-05 Thread [EMAIL PROTECTED]
Hello, I am still fighting with parsing out the html text and this is what I have so far, but seems I keep hitting my head against a barrier. >>> import os >>> from BeautifulSoup import BeautifulSoup >>> file = '/home/david/test/stack.html' >>> html = open(file, 'r') >>> soup = BeautifulSoup(html

[Tutor] Empty list validation

2008-06-09 Thread [EMAIL PROTECTED]
Hello Sorry if this is a basic question, but how do I check if list is empty or not and return True or False ;) Thanks David ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Empty list validation

2008-06-09 Thread [EMAIL PROTECTED]
Thank you all for the replies. the 'else' is this necessary, surely when you have an: >>> if x: ... print 'x' ...print 'y' is this correct? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] RegEx to search for the '$' symbol

2008-06-11 Thread [EMAIL PROTECTED]
Hi, Silly question but how do you use python's re module to find dictionary items that contain the '$' symbol. Thanks David ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] RegEx to search for the '$' symbol

2008-06-11 Thread [EMAIL PROTECTED]
thank you all. __ New Online ID Theft Protection - http://www.tiscali.co.uk/spyguard ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Dictionary within a dictionary

2008-06-12 Thread [EMAIL PROTECTED]
Hi, I would like to understand how to generate dictionaries based on other dictionaries. For example, I have a 3 tables in ym SQL database - Groups, Categories and Sub-categories with a one-to-many relations between each. I am presuming that each of these tables is one of my dictionaries?!?! W

Re: [Tutor] Dictionary within a dictionary

2008-06-13 Thread [EMAIL PROTECTED]
Hi, Following Alan's post, what I was trying to do is to understand how I can return the sub-item within the same space, if it makes sense ;) For example, in my 3 one-to-many lists, I want to generate this list: [{'id': , 'category': [{'id': , 'sub-c

Re: [Tutor] Dictionary within a dictionary

2008-06-14 Thread [EMAIL PROTECTED]
Hello, Thank you for the replies. I wanted to hold the data in memory, because the number of records do not warrant the need to have to maintain an additional relational database. Plus I wanted to understand how to build this using classes as this will perhaps give me the bridge I require to mo

[Tutor] Python Basic Help

2008-10-13 Thread [EMAIL PROTECTED]
Hey My name is Tanya and i am new to python programmin. I have few questions which hopefully will clear my doubts. * First question, we are given a list L = [ 345 , 32525 , 525 , 53245 , 6536 ] how would i add them? like in this form - 3+4+5+3+2+5+.   * 2nd Question, we are

[Tutor] csv manipulation

2008-10-29 Thread [EMAIL PROTECTED]
hello, i have the follwoing csv file: "Berat","Berat","Kuçovë","Skrapar" "Dibër","Bulqizë","Dibër","Mat" "Durrës","Durrës","Krujë" "Elbasan","Elbasan","Gramsh","Librazhd","Peqin" "Fier","Fier","Lushnjë","Mallakastër" "Gjirokastër","Gjirokastër","Përmet","Tepelenë" "Korçë","Devoll","Kolonjë","Korçë

[Tutor] mergin two csv files based on a common join

2008-10-31 Thread [EMAIL PROTECTED]
Hello again, Thanks for the replies on my previous post, but I have a different problem now and don't see how to deal with it in a smooth way. I have two csv files where: 1.csv "1", "text", "aa" "2", "text2", "something else" "3", "text3", "something else" 2.csv "text", "xx" "text", "yy" "tex

[Tutor] validating decimal class

2008-11-05 Thread [EMAIL PROTECTED]
hello silly question, but i can't seem to figure it it. I have an object which is: >>> type(price) but i can't figure how to validate against it. >>>if not isinstance(price, decimal.Decimal): do something... how do i ensure that the object 'price' is a decimal? thanks