[Tutor] variable name based on variables (expansion?)

2005-02-28 Thread John Christian
a python 2.3 noob asks: # I have some lists GameLogic.varList0=[1,1,1,1] GameLogic.varList1=[1,1,1,1] GameLogic.varList3=[1,1,1,1] # I want to change specific list elements GameLogic.varList0[2]=0 print GameLogic.varList0 [1,1,0,1] # But I want the assignment # to be based on variables LIST=1

Re: [Tutor] variable name based on variables (expansion?)

2005-02-28 Thread Martin Walsh
John Christian wrote: # But I want the assignment # to be based on variables LIST=1 POSITION=2 GameLogic.varList$LIST[$POSITION]=0 help(getattr) Help on built-in function getattr: getattr(...) getattr(object, name[, default]) - value Get a named attribute from an object; getattr(x, 'y')

Re: [Tutor] variable name based on variables (expansion?)

2005-02-28 Thread Bill Mill
John, On Mon, 28 Feb 2005 06:05:44 -0800 (PST), John Christian [EMAIL PROTECTED] wrote: a python 2.3 noob asks: # I have some lists GameLogic.varList0=[1,1,1,1] GameLogic.varList1=[1,1,1,1] GameLogic.varList3=[1,1,1,1] # I want to change specific list elements GameLogic.varList0[2]=0

RE: [Tutor] sys.argv[1: ] help

2005-02-28 Thread Smith, Jeff
Richard, I have no problems running your example. It would be helpful in the future ot let us know which version and variant of Python you are running. I am using the canonical (as oppose to ActiveState) Python 2.4. From the command prompt, type assoc .py and you should see .py=Python.File

Re: [Tutor] sys.argv[1: ] help

2005-02-28 Thread Richard gelling
Hi, Thanks a lot to everyone that replied. I was missing the %* in the following line, in the File associations I just had upto the %1. Adding %* cured my problem. Python.File=C:\Python24\python.exe %1 %* Sorry for the typos in some of my examples, every keyboard I've tried appears to have the

[Tutor] Edonkey Automatic Search Program?!

2005-02-28 Thread . ,
Hi, I just want to know whether this program can be programmed by python or not. p2p program like edonkey is very very complicated (I think so..) but, is searching program for edonkey complicated too? Should the search program be connected to edonkey? (I think so..) The Edonkey Automatic Search

Re: [Tutor] Edonkey Automatic Search Program?!

2005-02-28 Thread Liam Clarke
You sure could write a client for the eDonkey p2p protocol using Python, the original BitTorrent protocol and client was written in Python. You can download the source somewhere on www.bittorrent.org. But yeah, good luck with that. Regards, Liam Clarke On Mon, 28 Feb 2005 19:48:00 +, .

Re: [Tutor] Python and a web image map

2005-02-28 Thread Liam Clarke
I would say it's best done as a Javascript thing. html head script type = text/javascript function goFunc(e){ x = e.clientX y = e.clientY alert(X= + x + Y= + y) } /script /head body script type = text/javascript window.onload = function(e){document.onclick = goFunc;}; /script Javascript or

[Tutor] printing out a box of O's

2005-02-28 Thread Kevin
I just started getting in to python and for taking a look at the for loop. I want to print out a box of O's 10o chars long by 10 lines long this is what I came up with. Is there a better way to do this: j = 'O' for i in j*10: print i * 100 Thanks Kevin

Re: [Tutor] printing out a box of O's

2005-02-28 Thread Liam Clarke
for y in range(10): for x in range(10): print O, print '\n' Or - for y in range(10): print O*10 On Mon, 28 Feb 2005 18:35:08 -0600, Kevin [EMAIL PROTECTED] wrote: I just started getting in to python and for taking a look at the for loop. I want to print out a

Re: [Tutor] Python and a web image map

2005-02-28 Thread Danny Yoo
Save the above as an HTM and click, it should give you the x,y co-ords for the browser window excluding scrolbars etc. It is possible to do this with Python, since a server-side HTML ISMAP will send its coordinates off as part of the request. There are some notes here:

[Tutor] Criticism / Suggestions

2005-02-28 Thread Bill Kranec
Hello, So I think that I've 'completed' my first real Python program, and I would appreciate any constructive criticism you all could offer. The program deals with a question that my Dad asked me awhile ago, which was If twelve people want to divide into teams of two and play (golf) against

[Tutor] How to read unicode strings from a binary file and display them as plain ascii?

2005-02-28 Thread R. Alan Monroe
I started writing a program to parse the headers of truetype fonts to examine their family info. But I can't manage to print out the strings without the zero bytes in between each character (they display as a black block labeled 'NUL' in Scite's output pane) I tried: stuff = f.read(nlength)

[Tutor] Re: How to read unicode strings from a binary file and display them as plain ascii?

2005-02-28 Thread Javier Ruere
R. Alan Monroe wrote: I started writing a program to parse the headers of truetype fonts to examine their family info. But I can't manage to print out the strings without the zero bytes in between each character (they display as a black block labeled 'NUL' in Scite's output pane) I tried:

Re: [Tutor] Python and a web image map

2005-02-28 Thread Alan Gauld
I have been doing Python for a bit now but I am trying to make a clickable map of the world on a web page that gives me the latitude and longitude of a location selected. I have done little with HTML beyond forms and have done no Java script. Is this a problem Python can solve or is this a

Re: [Tutor] printing out a box of O's

2005-02-28 Thread Alan Gauld
- Original Message - From: Kevin [EMAIL PROTECTED] To: tutor@python.org Sent: Tuesday, March 01, 2005 12:35 AM Subject: [Tutor] printing out a box of O's there a better way to do this: j = 'O' for i in j*10: print i * 100 Its not bad, but the for loop could be 'simplified' to: