[Tutor] more rps

2006-08-14 Thread Christopher Spears
Here is the latest version of my Rock, Paper, Scissors game: #!/usr/bin/python import random random.seed() class Human: def __init__(self): self.points = 0 self.choice = " " def plays(self): fromUser = raw_input("Pi

Re: [Tutor] What does import really do?

2006-08-14 Thread jim stockford
many thanks. wrt import and what's named, in the case of the PIL library, the import statement can be import Image # not import PIL my presumption is that the PIL whatever-it-is contains a set of whatever-they-are, one of which is named Image. I like to use proper terminology, by way o

Re: [Tutor] processing multi entry logs

2006-08-14 Thread Luke Paireepinart
Reed L. O'Brien wrote: > I have a log file. Essentially the file has 2 important entries for > each process id. One when the process starts with an id and a another > piece of data. the second is when the process finishes, with the > result also with the process id. I need to get data from both

Re: [Tutor] What does import really do?

2006-08-14 Thread Luke Paireepinart
jim stockford wrote: Hi Jim. > For example, > import os > import sys > > My take is that one uses the import keyword in a > program. > The Python interpreter reads the program and > generates machine code. > The import keyword directs the Python interpreter > to find some library (which

[Tutor] processing multi entry logs

2006-08-14 Thread Reed L. O'Brien
I have a log file. Essentially the file has 2 important entries for each process id. One when the process starts with an id and a another piece of data. the second is when the process finishes, with the result also with the process id. I need to get data from both to make a sensible representation

[Tutor] What does import really do?

2006-08-14 Thread jim stockford
For example, import os import sys My take is that one uses the import keyword in a program. The Python interpreter reads the program and generates machine code. The import keyword directs the Python interpreter to find some library (which is not necessarily named, certainly not necess

Re: [Tutor] Python on network problems

2006-08-14 Thread Diana Hawksworth
Sorry Alan. Replied to Luke - but didn't include that to the tutor list as a whole! We are running Windows XP. The students log in to a network server that allows them access to their user accounts as well as various group folders. We have 4 rooms full of computers - but Python is installed

Re: [Tutor] Global variables

2006-08-14 Thread Bob Gailer
A while back you attached factor34.py. Is that the program you are having trouble with? And you said it misbehaves "consistently with certain numbers to be factored." What are these numbers? -- Bob Gailer 510-978-4454 ___ Tutor maillist - Tutor@pyt

Re: [Tutor] Global variables

2006-08-14 Thread Luke Paireepinart
Kermit Rose wrote: > > > From: Alan Gauld > Date: 08/14/06 18:42:41 > To: Kermit Rose; Luke Paireepinart > Cc: tutor@python.org; Danny Yoo > Subject: Re: [Tutor] Global variables > > > That may be true but you will make your code much less reusable > and much more error propne in the

Re: [Tutor] Global variables

2006-08-14 Thread John Fouhy
On 15/08/06, Kermit Rose <[EMAIL PROTECTED]> wrote: > My routine strongfac calculates a value for fac in the subroutine, and the > calling routine picks up a different vaalue. > > An illustration. > > In strong fac: > > fac = [1,2,3] > print fac > return fac > > in fermat: > > fac = strongfac(z) >

Re: [Tutor] Global variables

2006-08-14 Thread Kermit Rose
From: Alan Gauld Date: 08/14/06 18:42:41 To: Kermit Rose; Luke Paireepinart Cc: tutor@python.org; Danny Yoo Subject: Re: [Tutor] Global variables That may be true but you will make your code much less reusable and much more error propne in the process. There are good reasons why glob

Re: [Tutor] Global variables

2006-08-14 Thread Kermit Rose
From: Luke Paireepinart Date: 08/14/06 17:17:13 To: Kermit Rose Cc: Danny Yoo; tutor@python.org Subject: Re: [Tutor] Global variables > From: Luke Paireepinart > > are you asking a question? > > > Kermit Rose wrote: > > > Yes. How can I make a package of functions declare global

Re: [Tutor] Global variables

2006-08-14 Thread Alan Gauld
>> If I can figure out how to make my main function subroutine declare >> global >> variables then I won't need to pass parameters most parameters to >> the other >> subroutines, That may be true but you will make your code much less reusable and much more error propne in the process. There are

Re: [Tutor] How to un-import modules?

2006-08-14 Thread Alan Gauld
>> Actually, my question is, after using IDLE to do some importing of >> modules and initializing of variables, how to return it to it's >> initial condition without closing and reopening it. Doesn't Shell->Restart shell do this? Alan G. ___ Tutor mail

Re: [Tutor] Regex

2006-08-14 Thread Alan Gauld
> so I thought I'd write something like this: > > filename = '/home/acl_home/PhD/CurrentPhD/extensions1_14.8.6.tex' > > infile = open(filename,'r') > > def_start = "\\begin\{defn\}" > def_end = "\end{defn}" > > def_start_reg = re.compile(def_start) > > l = 0 > while l < 500: > line = infil

Re: [Tutor] how to remove html ags

2006-08-14 Thread John Fouhy
On 15/08/06, anil maran <[EMAIL PROTECTED]> wrote: > hi luke > i tried to do this for 2 weeks using the regexps > i couldnt find it > and hence i was asking you guys > thanks > anil What have you tried? What problems were you having? -- John. ___ Tuto

Re: [Tutor] how to remove html ags

2006-08-14 Thread anil maran
hi lukei tried to do this for 2 weeks using the regexpsi couldnt find itand hence i was asking you guysthanksanilLuke Paireepinart <[EMAIL PROTECTED]> wrote: anil maran wrote:> how to do regular expressions> and remove waht is in and also the brackets> <> Talk is cheap. Use Yahoo! Messenger to m

Re: [Tutor] how to remove html ags

2006-08-14 Thread Luke Paireepinart
anil maran wrote: > how to do regular expressions > and remove waht is in and also the brackets > <> I'm not answering any more of your questions until you read http://www.catb.org/~esr/faqs/smart-questions.html The information you want you could find in any regexp tutorial. If you have a problem

Re: [Tutor] How to un-import modules?

2006-08-14 Thread Luke Paireepinart
Michael P. Reilly wrote: > On 8/14/06, *Dick Moores* <[EMAIL PROTECTED] > > wrote: > > Actually, my question is, after using IDLE to do some importing of > modules and initializing of variables, how to return it to it's > initial condition without closing and

Re: [Tutor] Global variables

2006-08-14 Thread Luke Paireepinart
> From: Luke Paireepinart > > are you asking a question? > > > Kermit Rose wrote: > > > Yes. How can I make a package of functions declare global variables for > passing information between > the functions in the package? > > a 'package' meaning a module? If you think you need g

Re: [Tutor] how to remove html ags

2006-08-14 Thread anil maran
how to do regular expressionsand remove waht is in and also the brackets<>Kent Johnson <[EMAIL PROTECTED]> wrote: anil maran wrote:> Human nature is not a machin... > >> for example in the above stirng>> i want to remove > and Try one of these:http://www.oluyede.org/blog/2006/02/13/html-stripper/ht

Re: [Tutor] How to un-import modules?

2006-08-14 Thread Michael P. Reilly
On 8/14/06, Dick Moores <[EMAIL PROTECTED]> wrote: Actually, my question is, after using IDLE to do some importing ofmodules and initializing of variables, how to return it to it'sinitial condition without closing and reopening it.So, for example after I've done >>> import math, psyco >>> a = 4**2

Re: [Tutor] Global variables

2006-08-14 Thread Kermit Rose
From: Luke Paireepinart Date: 08/13/06 22:28:50 To: Kermit Rose Cc: Danny Yoo; tutor@python.org Subject: Re: [Tutor] Global variables Kermit Rose wrote: > > > From: Danny Yoo > Date: 08/09/06 16:23:35 > To: Kermit Rose > Cc: tutor@python.org > > > If I can figure out how to make

[Tutor] How to un-import modules?

2006-08-14 Thread Dick Moores
Actually, my question is, after using IDLE to do some importing of modules and initializing of variables, how to return it to it's initial condition without closing and reopening it. So, for example after I've done >>> import math, psyco >>> a = 4**23 How can I wipe those out without closing

[Tutor] Regex

2006-08-14 Thread Matt Williams
Dear All, I know this has come up loads of times before, but I'm stuck with what should be a simple Regex problem. I'm trying to pull all the definitions from a latex document. these are marked \begin{defn} \end{defn} so I thought I'd write something like this: filename = '/home/acl_home/P

Re: [Tutor] SGMLLib, fetching some weird data

2006-08-14 Thread Kent Johnson
Basil Shubin wrote: > Hi friends, > > Please, examine attached script. I want fetch some data from online > resource and almost achieve this, but I can't fetch some weird formatted > data like this '45° Reverse Calf Press'. I got the following error: > > 45 > Reverse Calf Press > Reverse Calf R

Re: [Tutor] how to remove html ags

2006-08-14 Thread Kent Johnson
anil maran wrote: > Human nature is not a machin... > > > for example in the above stirng > > i want to remove > and Try one of these: http://www.oluyede.org/blog/2006/02/13/html-stripper/ http://www.aminus.org/rbre/python/cleanhtml.py > > i tried

Re: [Tutor] i18n Encoding/Decoding issues

2006-08-14 Thread Kent Johnson
Jorge De Castro wrote: > Hi all, > > It seems I can't get rid of my continuous issues i18n with Python :( > You're not alone :-) > I've been through: > http://docs.python.org/lib/module-email.Header.html > and > http://www.reportlab.com/i18n/python_unicode_tutorial.html > to no avail. > Try t

Re: [Tutor] suggestions for read unread items datastructure

2006-08-14 Thread Luke Paireepinart
anil maran wrote: > i m sure the users need to maintain their own data, > but as a provider we need to store their information > right, sessions and cookies work only during their > stay in the site, after they exit, im sure they would > like to come back to the same info, wont u > > so i was wonde

Re: [Tutor] Python on network problems

2006-08-14 Thread Alan Gauld
Diana, It is almost certainly not a Python problem but related to how you have the network set up. As Luke was trying to point out, we mifght be able to help out but your description of the network setup wasn't clear. We need more precise information about things like: what OS you are using? Are

Re: [Tutor] Having trouble getting mind around decimal module

2006-08-14 Thread Alan Gauld
> >>> from decimal import Decimal > >>> getcontext().prec = 32 > >>> Decimal(1) / Decimal(7) > Decimal("0.14285714285714285714285714285714") > > But I can't figure out how to compute to 32 places things like the > square root of 2, or the arc tangent of .41. Could someone please > show me? The f

Re: [Tutor] Having trouble getting mind around decimal module

2006-08-14 Thread Luke Paireepinart
Dick Moores wrote: > I'm having trouble getting my mind around the decimal module. From > the tutorial () I > can see how to get 1/7 to, say, 32 places: > > >>> from decimal import Decimal > >>> getcontext().prec = 32 > >>> Decimal(1) / Decimal