Re: [Tutor] opts and try except

2005-11-20 Thread Johan Geldenhuys
Maybe this recipe will help. Here I used and tested the arguments that the user must enter before using the module: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440476 Johan Eric Walker wrote: >All, >I have a program now that works just like I want it. Now I want to >integerate som

Re: [Tutor] How should I store data ?

2005-11-20 Thread Alan Gauld
>I want to store data in the shape of (for example): > First name, Last name, Age, ... few more characteristics. > I must be able to search data by any of this fields. For example, search > for age, or name ... etc For small quantities you can store the data in a list or tuple or dictionary.

Re: [Tutor] Dynamic inheritance?

2005-11-20 Thread Kent Johnson
Jan Eden wrote: > The situation is this: > > For every object, two string attributes are determined during > initialization (one being read from a database, the other inherited > as a superclass attribute). The first contains the site name, the > second the object type. I'd like to set the templat

[Tutor] need help in how to make my script read arabic lang

2005-11-20 Thread enas khalil
hello , i want to know if yu please how can i use python code in tagging arabic text file my code is as follow : # -*- coding: cp1256 -*-import codecsfrom nltk.tagger import *from nltk.corpus import brownfrom nltk.tokenizer import WhitespaceTokenizerfrom nltk import *from nltk.tokenreader.tagge

Re: [Tutor] smtplib alternative???

2005-11-20 Thread Adisegna
Hi Danny, Yes, when sending an email your mail client will always send the email to the mail server specified by the MX record in the authoritive domain. Usually the domain specificed after the @ symbol. The problem with smtplib is that I have to specify the mail server I'm sending email too. Wh

Re: [Tutor] Dynamic inheritance?

2005-11-20 Thread Jan Eden
Kent Johnson wrote on 20.11.2005: >Use getattr() to access attributes by name. SiteA is an attribute of Templates >and Page is an attribute of SiteA so you can get use getattr() twice to get >what >you want: > >site = getattr(Templates, self.site_name) >self.template = getattr(site, self.templa

[Tutor] Can Phython...

2005-11-20 Thread Merrie
Hello everyone, thank you for having this list. I have a couple of starting questions as I learn Python.   My goal is to create something similar to Phaos, a browser controlled text base game written in PHP and MySQL. http://www.3eproductions.com/games.php   But as Python is easier to learn a

Re: [Tutor] smtplib alternative???

2005-11-20 Thread Nick Lunt
Hi Adisegna, Lets say that you are [EMAIL PROTECTED] and you want to send email to [EMAIL PROTECTED], [EMAIL PROTECTED] and [EMAIL PROTECTED] . You setup SMTPLib to talk to the MX server for abc.com which all users on abc.com use to send email. SMTP connects to that email server and you can send

Re: [Tutor] Dynamic inheritance?

2005-11-20 Thread Alan Gauld
> import Templates > > self.site_name = 'SiteA' > self.template_type = 'Page' > > self.template = ??? How about a dictionary holding references to the classes against their names? The dictionary could be a class attribute of the top level superclass or a module level dictionary. It should be upd

[Tutor] Website monitoring program.

2005-11-20 Thread Adisegna
I guess I should keep the same subject line (above) from now on since my last few posts (urllib, smtplib) are about the same program.  My question is how to use a loop to go through a tuple of URLs. Please feel free to suggest an easier way to do the same thing. Here is my rudimentary program so

Re: [Tutor] Can Phython...

2005-11-20 Thread Alan Gauld
> My goal is to create a browser controlled text base game ... >So a few of my starting questions. > 1 - Is what I have described above possible? Yes > 2 - What modules or components will I need? That depends onthe gane to some extent, I don;t know it. But for HTML/Web apps you need to decide i

[Tutor] need a tutorial in tokens ,different types

2005-11-20 Thread enas khalil
hello all could any one suggest me tutorials in different tokenizations and clear describtion of how can i use token type and assign diff attributes to tokens  ,also good tutorials in diff data types in python thanks every body enas Yahoo! FareChase - Search multiple travel sites in one clic

Re: [Tutor] Website monitoring program.

2005-11-20 Thread Kent Johnson
Adisegna wrote: > > I guess I should keep the same subject line (above) from now on since my > last few posts (urllib, smtplib) are about the same program. My preference is to start a new subject for each new question. > > My question is how to use a loop to go through a tuple of URLs. Please

[Tutor] UnboundLocal Error

2005-11-20 Thread Jason Massey
I've got a problem with scope that I can't say I've ever encountered. The comments explain the situation pretty well. import player class Game: def __init__(self,screen): self.market = Market.Market() self.countries = pickle.load(open("sup.coords",'r'))

[Tutor] Random Numbers

2005-11-20 Thread Merrie
Ok first thing I need a direction on is random number generation, I looked through the Python manual and I must be missing it.   What Im looking for, needing is a random generation 1 through 10 + modifier, example like rolling a 1d10 +1   Not sure what syntex to use.   Thanks! Merrie ___

Re: [Tutor] Random Numbers

2005-11-20 Thread John Fouhy
On 21/11/05, Merrie <[EMAIL PROTECTED]> wrote: > Ok first thing I need a direction on is random number generation, I looked > through the Python manual and I must be missing it. > > What Im looking for, needing is a random generation 1 through 10 + modifier, > example like rolling a 1d10 +1 Hi Me

Re: [Tutor] Random Numbers

2005-11-20 Thread Hugo González Monteverde
Hi, Take a look at the random module, function randint: >>> import random >>> random.randint(1, 10) 7 >>> random.randint(1, 10) 9 >>> random.randint(1, 10) 1 >>> random.randint(1, 10) 8 >>> random.randint(1, 10) 7 >>> random.randint(1, 10) 9 >>> random.randint(1, 10) 1 >>> random.randint

Re: [Tutor] Website monitoring program.

2005-11-20 Thread Liam Clarke-Hutchinson
Ah, this kind of programme would be so much simpler if Last-Modified and ETag were commonly used *sigh*. Unfortunately, advertising kinda killed it... I recommend www.watchthispage.com if you just need a quick update without killing your own bandwidth. Regards, Liam Clarke-Hutchinson -

Re: [Tutor] UnboundLocal Error

2005-11-20 Thread Kent Johnson
Jason Massey wrote: > I've got a problem with scope that I can't say I've ever encountered. My guess is that later in setupPlayers() you assign to a variable 'player'. When you do this, every reference to the variable in the function is a local reference. For example: >>> x=1 >>> def bump():

Re: [Tutor] need a tutorial in tokens ,different types

2005-11-20 Thread Alan Gauld
> could any one suggest me tutorials in different tokenizations and > clear describtion of how can i use token type and assign diff attributes > to tokens What kind of tokens? Are we talking l;exical tokens in a parser or security tokens or what? > also good tutorials in diff data types in

Re: [Tutor] UnboundLocal Error

2005-11-20 Thread Alan Gauld
> The comments explain the situation pretty well. Unfortunately the formatting has been lost so I'm not totally clear whats going on. BUT it does look like you have posted the class definition but not the driver code that actually causes the error. > class Game: > def __init__(self,screen): > pr

Re: [Tutor] smtplib alternative???

2005-11-20 Thread Liam Clarke-Hutchinson
>Generally smtp servers are only configured to send to or from domains in which they belong. Hmmm... several ISP's I've used allow any value in the "From" header field. I'd also like to mention that while many SMTP servers will only allow a valid domain address in the From field, there is usuall

Re: [Tutor] smtplib alternative???

2005-11-20 Thread Python
On Sun, 2005-11-20 at 09:26 -0500, Adisegna wrote: > Hi Danny, > > Yes, when sending an email your mail client will always send the email > to the mail server specified by the MX record in the authoritive > domain. Usually the domain specificed after the @ symbol. The problem > with smtplib is tha

[Tutor] Website monitoring program.

2005-11-20 Thread Adisegna
How do I get the counting loop to come back around? It makes one pass fine. How do I get it to come back up and go through again?  Thanks --- import urllib, smtplib urls = ("http://website0.net/imalive.asp",   "http://website1.net/imal

Re: [Tutor] Website monitoring program.

2005-11-20 Thread Kent Johnson
Adisegna wrote: > How do I get the counting loop to come back around? It makes one pass > fine. How do I get it to come back up and go through again? You have to indent the statement 'count += 1' so it is part of the loop. But you misunderstand the for loop - the count variable is not needed at

[Tutor] Trouble with classes - Pypeg again

2005-11-20 Thread ->Terry<-
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ok, I've got my peg game roughed out and I'm having problems. The error is: Traceback (most recent call last): File "pypeg.py", line 113, in ? main() File "pypeg.py", line 107, in main x.draw_board() # Refresh scr

Re: [Tutor] need a tutorial in tokens ,different types

2005-11-20 Thread Danny Yoo
Taking python-list out of CC yet again. Enas, please fix your email client setup. I really don't want to threaten, but as a power-hungry dictatorial list admin, I have an responsibility to help maintain a healthy mailing list. You been warned twice now not to crosspost. You continue to crossp

[Tutor] reduce with comprehension

2005-11-20 Thread János Juhász
Hi, I can't imagine how this could be made with list comprehension. >>> import operator >>> a = (([1],[2],[3,31,32],[4]), ([5],[6],[7, 71, 72]), ([8],[9])) >>> reduce(operator.add, a) # it makes a long list now ([1], [2], [3, 31, 32], [4], [5], [6], [7, 71, 72], [8], [9]) When I make list compre