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
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')
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
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
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
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
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 +, .
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
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
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
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:
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
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)
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:
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
- 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:
16 matches
Mail list logo