Re: [newbie] help with pygame-tutorial

2012-04-10 Thread aapeetnootjes
Op maandag 9 april 2012 22:51:48 UTC+2 schreef Roy Smith het volgende: > In article > <1a558398-3984-4b20-8d67-a0807871b...@v1g2000yqm.googlegroups.com>, > aapeetnootjes wrote: > > > I'm trying out the pygame tutorial at > > http://www.pygame.org/docs/tut/intro/intro.html > > If I try out the

Re: [newbie] help with pygame-tutorial

2012-04-09 Thread Roy Smith
In article <1a558398-3984-4b20-8d67-a0807871b...@v1g2000yqm.googlegroups.com>, aapeetnootjes wrote: > I'm trying out the pygame tutorial at > http://www.pygame.org/docs/tut/intro/intro.html > If I try out the code I'm facing an error: > ./game.py: line 4: syntax error at unexpected symbol 'si

Re: [newbie] help with pygame-tutorial

2012-04-09 Thread MRAB
On 09/04/2012 21:20, aapeetnootjes wrote: I'm trying out the pygame tutorial at http://www.pygame.org/docs/tut/intro/intro.html If I try out the code I'm facing an error: ./game.py: line 4: syntax error at unexpected symbol 'size' ./game.py: line 4: `size = width, height = 320, 240' can anyone

[newbie] help with pygame-tutorial

2012-04-09 Thread aapeetnootjes
I'm trying out the pygame tutorial at http://www.pygame.org/docs/tut/intro/intro.html If I try out the code I'm facing an error: ./game.py: line 4: syntax error at unexpected symbol 'size' ./game.py: line 4: `size = width, height = 320, 240' can anyone here tell me what's going wrong? thanks --

Re: Newbie Help

2012-01-11 Thread mixolydian
mixolydian wrote: >I want to get into Python progamming for both local database applications and >dynamic web pages. Maybe some Q&D scripts. >There is a ton of excellent language books. > >I have downloaded and installed 2.7.2 and got it working by pasting samples >into IDLE, and uploading to my

Re: Newbie Help

2012-01-04 Thread Ben Finney
Ben Finney writes: > * Cross-platform, so that you're not denied the use of any popular > workstation OS. > > For my purposes, either { GNU Screen + Bash + Emacs } or { GNU Screen + > Bash + Vim } are good choices satisfying all the above criteria. There > may be other good combinations. I sli

Re: Newbie Help

2012-01-04 Thread HoneyMonster
On Tue, 03 Jan 2012 17:13:17 -0600, mixolydian wrote: > I want to get into Python progamming for both local database > applications and dynamic web pages. Maybe some Q&D scripts. I am new to Python too, and recently completed my first "real" cross- platform GUI application with local/remote datab

Re: Newbie Help

2012-01-03 Thread Steven D'Aprano
On Tue, 03 Jan 2012 17:13:17 -0600, mixolydian wrote: > I would like some advice on: > 1. IDEs Avoid them. Everything you need can be used with two applications: - a programmer's text editor; - a decent terminal (console) application. A decent text editor will allow you to have multiple files

Re: Newbie Help

2012-01-03 Thread Ben Finney
mixolydian writes: > I want to get into Python progamming for both local database > applications and dynamic web pages. Maybe some Q&D scripts. Welcome to the Python community. You have found a good general-purpose programming language, and I hope you find the right help for what you're trying t

Newbie Help

2012-01-03 Thread mixolydian
I want to get into Python progamming for both local database applications and dynamic web pages. Maybe some Q&D scripts. There is a ton of excellent language books. I have downloaded and installed 2.7.2 and got it working by pasting samples into IDLE, and uploading to my web server and doing tri

Re: Newbie help - Programming the Semantic Web with Python

2011-07-16 Thread Bruce Whealton
those included modules would have to get compiled with the rest of the code for it to work, right? Bruce -Original Message- From: Chris Angelico Sent: Saturday, July 09, 2011 10:10 PM To: python-list@python.org Subject: Re: Newbie help - Programming the Semantic Web with Python On Sun, Jul

Re: Newbie help - Programming the Semantic Web with Python

2011-07-11 Thread Bruce Whealton
This didn't seem to work either. I was getting errors the number of arguments expected being two, when I changed to def add (self, args): I seem to remember that if I removed the parentheses around sub, pred, obj, it worked. I thought that was how it worked. What is strange is that this is n

Re: Newbie help - Programming the Semantic Web with Python

2011-07-10 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.10 02:28 PM, Bruce Whealton wrote: > If you know of any good resources for finding python applications on > the web, this might be a good way to learn. I don't know if I > should look for Python applications, or if I'll have more luck

Re: Newbie help - Programming the Semantic Web with Python

2011-07-10 Thread Bruce Whealton
n the web, this might be a good way to learn. I don't know if I should look for Python applications, or if I'll have more luck looking for Python Libraries. Thanks, Bruce -Original Message- From: Andrew Berg Sent: Saturday, July 09, 2011 10:44 PM To: comp.lang.python Subje

Re: Newbie help - Programming the Semantic Web with Python

2011-07-09 Thread Andrew Berg
On 2011.07.09 08:32 PM, Bruce Whealton wrote: > Hello, > So, I got this book on Programming the Semantic Web about > the same time I started learning Python. The code seems to be > developed for python 2.7 and not 3, I believe. If you're going to learn Python 3, I suggest learning from

Re: Newbie help - Programming the Semantic Web with Python

2011-07-09 Thread Chris Angelico
On Sun, Jul 10, 2011 at 11:32 AM, Bruce Whealton wrote: problem with is this line: >     def add(self, (sub, pred, obj)): > I think the problem is with the parentheses before the sub.  I removed those > and that seemed to fix that error or make it go away.  I don’t remember how I > figured that

Newbie help - Programming the Semantic Web with Python

2011-07-09 Thread Bruce Whealton
Hello, So, I got this book on Programming the Semantic Web about the same time I started learning Python. The code seems to be developed for python 2.7 and not 3, I believe. The code is here: http://semprog.com/content/the-book/ I tried to run simpletriple.py from inside eclipse wit

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 21:27:12 -0800, Nav wrote: > @ Steven > "No, you're confused -- the problem isn't with using the global > namespace. > The problem is that you don't know what names you want to use ahead of > time. " > > Actually I know what the names would be and how I want to use them.

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
"> if yes then: > if using globalnamespace is bad then why does every book or tutorial > about python classes give the above style of assignment as an > example? That's a basic assignment example. It's not a direct manipulation of globals(), like the solution given by Jan, which you seem to fee

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Dave Angel
(You top-posted. It's polite on most newsgroups, and specifically on this one to add your comments *following* the quoted earlier text) Nav wrote: Okay, let me ask another question: When we create instances of objects by doing x = className () are we using globalnamespace? If that line ap

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread alex23
On Jan 5, 1:12 pm, Nav wrote: > When we create instances of objects by doing > x = className () > are we using globalnamespace? Well, you're using a namespace, which namespaces its in would depend on the scope in which that assignment occurred. And there's not really a global namespace, only modu

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 19:12:53 -0800, Nav wrote: > Okay, let me ask another question: > > When we create instances of objects by doing > x = className() > are we using globalnamespace? That depends on whether you are doing x = className() inside a function (or class), or in the top level of the

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
Thanks for pointing it out Steve. The blog post doesn't explain it very well. I understand the risk of exec or eval(input). but what are the risks of globalnamespace use and what are the benefits? -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
Okay, let me ask another question: When we create instances of objects by doing x = className () are we using globalnamespace? if yes then: if using globalnamespace is bad then why does every book or tutorial about python classes give the above style of assignment as an example? Second why do

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread alex23
On Jan 5, 9:33 am, Nav wrote: > what are the risks of globalnamespace use You're unnecessarily tying your code to the implementation. > and what are the benefits? Absolutely none that using a dictionary doesn't also give you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
Thanks Jan, You read my mind. That is exactly what I needed. Thanks for showing the product function from itertools as well. It seems easier to grasp than the nested loops, I had been using. I noticed chopin.edu.pl. Are you a musician? Nav -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Steve Holden
Nav wrote: > On Jan 4, 4:54 pm, Chris Rebert wrote: >> On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: >>> You could put them in a dictionary with the key being the name, instead of >>> a list. >> To illustrate that for the OP: >> >> name2drink = {} >> for booze in liquors: >> for juic

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Shawn Milochik
On Jan 4, 2010, at 5:59 PM, Nav wrote: > On Jan 4, 4:54 pm, Chris Rebert wrote: >> On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: >>> You could put them in a dictionary with the key being the name, instead of >>> a list. >> >> To illustrate that for the OP: >> >> name2drink = {} >> fo

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
On Jan 4, 4:54 pm, Chris Rebert wrote: > On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: > > You could put them in a dictionary with the key being the name, instead of > > a list. > > To illustrate that for the OP: > > name2drink = {} > for booze in liquors: >     for juice in juices: >  

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Jan Kaliszewski
2010-01-04, 22:54:41 Chris Rebert wrote: name2drink = {} for booze in liquors: for juice in juices: name = juice +" "+booze # or however you're naming them drink = Bottle(booze, juice) name2drink[name] = drink @Nav: ...and if you really desire to have those objects

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Chris Rebert
On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: > You could put them in a dictionary with the key being the name, instead of a > list. To illustrate that for the OP: name2drink = {} for booze in liquors: for juice in juices: name = juice +" "+booze # or however you're naming t

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Shawn Milochik
You could put them in a dictionary with the key being the name, instead of a list. Shawn -- http://mail.python.org/mailman/listinfo/python-list

Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
I have a class of let's say empty bottle which can have a mix of two items. I want to create let's say 30 of these objects which will have names based on the 2 attributes (apple juice, beer, grape juice, beer, etc) that I provide from a list. All the objects are a mix of (1 of three alcohols) and (

Re: Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Mike Kazantsev
On Tue, 16 Jun 2009 23:20:05 +0200 Piet van Oostrum wrote: > > Matt (M) wrote: > > >M> Try replacing: > >M> cmd = [ "ls /path/to/file/"+staname+"_info.pf" ] > >M> with: > >M> cmd = [ “ls”, “/path/to/file/"+staname+"_info.pf" ] > > In addition I would like to remark that -- if the o

Re: Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Piet van Oostrum
> Matt (M) wrote: >M> Try replacing: >M> cmd = [ "ls /path/to/file/"+staname+"_info.pf" ] >M> with: >M> cmd = [ “ls”, “/path/to/file/"+staname+"_info.pf" ] In addition I would like to remark that -- if the only thing you want to do is to start up a new command with subprocess.Popen -

Re: Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Rob Newman
Thanks Matt - that worked. Kind regards, - Rob On Jun 16, 2009, at 12:47 PM, Matt wrote: Try replacing: cmd = [ "ls /path/to/file/"+staname+"_info.pf" ] with: cmd = [ “ls”, “/path/to/file/"+staname+"_info.pf" ] Basically, the first is the conceptual equivalent of executing the following

Re: Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Matt
Try replacing: cmd = [ "ls /path/to/file/"+staname+"_info.pf" ] with: cmd = [ “ls”, “/path/to/file/"+staname+"_info.pf" ] Basically, the first is the conceptual equivalent of executing the following in BASH: ‘ls /path/to/file/FOO_info.pf’ The second is this: ‘ls’ ‘/path/to/file/FOO_info.pf

Newbie help for using multiprocessing and subprocess packages for creating child processes

2009-06-16 Thread Rob Newman
Hi All, I am new to Python, and have a very specific task to accomplish. I have a command line shell script that takes two arguments: create_graphs.sh -v --sta=STANAME where STANAME is a string 4 characters long. create_graphs creates a series of graphs using Matlab (among other 3rd party

Re: Newbie help (TypeError: int argument required)

2008-06-08 Thread bukzor
On Jun 8, 11:43 am, Iain Adams <[EMAIL PROTECTED]> wrote: > Hi, > > I am new to python. I have been having trouble using the MysqlDB. I > get an error pointing from the line > > cursor.execute("UPDATE article SET title = %s, text = %s WHERE id = > %u", (self.title, self.text, self.id)) > > Here is

Re: Newbie help (TypeError: int argument required)

2008-06-08 Thread [EMAIL PROTECTED]
On Jun 8, 1:43 pm, Iain Adams <[EMAIL PROTECTED]> wrote: > Hi, > > I am new to python. I have been having trouble using the MysqlDB. I > get an error pointing from the line > > cursor.execute("UPDATE article SET title = %s, text = %s WHERE id = > %u", (self.title, self.text, self.id)) > > Here is t

Newbie help (TypeError: int argument required)

2008-06-08 Thread Iain Adams
Hi, I am new to python. I have been having trouble using the MysqlDB. I get an error pointing from the line cursor.execute("UPDATE article SET title = %s, text = %s WHERE id = %u", (self.title, self.text, self.id)) Here is the error: line 56, in save cursor.execute("UPDATE article SET titl

Newbie Help - Alarms

2008-04-28 Thread Paul Jefferson
Hi, I'm new to this having previously done some programming in Game Maker. In Game Maker there was a function (Alarm) that lets you run a block of code run every x seconds without freezing up the whole program waiting for it. Is there an equavalant for this built in Python beacuse I can't find it?

Re: (Newbie) Help with sockets.

2008-02-29 Thread mentaltruckdriver
On Feb 29, 9:42 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >> You claim to be writing a telnet server, yet I don't see any > >> code that actually implements the telnet protocol. Different > >> telnet clients default to different m

Re: (Newbie) Help with sockets.

2008-02-29 Thread Grant Edwards
On 2008-02-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> You claim to be writing a telnet server, yet I don't see any >> code that actually implements the telnet protocol. Different >> telnet clients default to different modes, so if you want them >> in a certain mode, you have to put them i

Re: (Newbie) Help with sockets.

2008-02-29 Thread mentaltruckdriver
On Feb 28, 11:22 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-02-29, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > > En Fri, 29 Feb 2008 00:20:26 -0200, <[EMAIL PROTECTED]> escribió: > > >> Hi everyone. I'm fairly new to Python, and even more new to socket > >> programming. I think I'v

Re: (Newbie) Help with sockets.

2008-02-28 Thread Grant Edwards
On 2008-02-29, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Fri, 29 Feb 2008 00:20:26 -0200, <[EMAIL PROTECTED]> escribió: > >> Hi everyone. I'm fairly new to Python, and even more new to socket >> programming. I think I've wrapped my head around sockets, and with >> that I want to create a Te

Re: (Newbie) Help with sockets.

2008-02-28 Thread Gabriel Genellina
En Fri, 29 Feb 2008 00:20:26 -0200, <[EMAIL PROTECTED]> escribió: > Hi everyone. I'm fairly new to Python, and even more new to socket > programming. I think I've wrapped my head around sockets, and with > that I want to create a Telnet-based chat server, the idea being > people connect to the tel

Re: (Newbie) Help with sockets.

2008-02-28 Thread Miki
Hello, > Hi everyone. I'm fairly new to Python, and even more new to socket > programming. I think I've wrapped my head around sockets, and with > that I want to create a Telnet-based chat server, the idea being > people connect to the telnet servers with their clients and they all > communicate.

(Newbie) Help with sockets.

2008-02-28 Thread mentaltruckdriver
Hi everyone. I'm fairly new to Python, and even more new to socket programming. I think I've wrapped my head around sockets, and with that I want to create a Telnet-based chat server, the idea being people connect to the telnet servers with their clients and they all communicate. I've got the code

Re: Newbie help understanding...

2007-05-26 Thread cmpython
The problem is that in your function t is a string (one of the cards in the list called "cards") and strings don't have the ability to use the append method. But lists do. Therefore t.append is wrong but cards.append works fine. (Append means "take the list you have and add what is in the parent

Re: Newbie help understanding...

2007-05-26 Thread Amit Khemka
On 26 May 2007 00:23:32 -0700, mark <[EMAIL PROTECTED]> wrote: > Hi I am trying to get a piece of code to work based on an exercise in > a book. Any help appreciated. Can someone please explain what is going > on here. > > I am trying to read from a text file a list of cards with the > following fo

Newbie help understanding...

2007-05-26 Thread mark
Hi I am trying to get a piece of code to work based on an exercise in a book. Any help appreciated. Can someone please explain what is going on here. I am trying to read from a text file a list of cards with the following format and sort firstly by suit and then by rank h 1 d 2 c 5 s 9 h2 d3 etc

Re: More newbie help required with dictionaries

2007-04-16 Thread loial
machines[machinekey] = [0,1,0,0,0,0,0,0,0,0,0,0,0] is what I needed...thanks On 16 Apr, 15:07, Christoph Haas <[EMAIL PROTECTED]> wrote: > On Mon, Apr 16, 2007 at 06:43:37AM -0700, loial wrote: > > The following code only returns the last row(22) added to the > > machines dictionary. > > pr

Re: More newbie help required with dictionaries

2007-04-16 Thread Christoph Haas
On Mon, Apr 16, 2007 at 06:43:37AM -0700, loial wrote: > The following code only returns the last row(22) added to the > machines dictionary. > presumably I need some additional syntax to add rows to the dictionary > rather than overwrite. > > What do I need to add? > > machinekey = "11"

More newbie help required with dictionaries

2007-04-16 Thread loial
The following code only returns the last row(22) added to the machines dictionary. presumably I need some additional syntax to add rows to the dictionary rather than overwrite. What do I need to add? machinekey = "11" machines = { machinekey:[1,0,0,0,0,0,0,0,0,0,0,0,0] } machinekey = "2

Re: Newbie help with array handling

2007-04-12 Thread Shane Geiger
""" Since you are a beginner and since RCCILA (Runnable, Commented Code Is Least Ambiguous) I'm proving this example code to help you get used to manipulating data with python. This should give you an idea of how to juggle a bit. After you learn how to do this you likely still will not be

Re: Newbie help with array handling

2007-04-12 Thread 7stud
On Apr 12, 3:50 am, "7stud" <[EMAIL PROTECTED]> wrote: > On Apr 12, 3:31 am, "loial" <[EMAIL PROTECTED]> wrote: > > lst = mydict["keyvalue1"] > lst[0] = 4 > list.append("red") Rather the last line there should read: lst.append("red") -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help with array handling

2007-04-12 Thread 7stud
On Apr 12, 3:31 am, "loial" <[EMAIL PROTECTED]> wrote: > OK, thanks for the replies > > One other thing...I need to update the values since they are basically > totals that I am accumulating. > > How do I update a specific value for a specific key? mydict["keyvalue1"] returns the value, which in

Re: Newbie help with array handling

2007-04-12 Thread loial
OK, thanks for the replies One other thing...I need to update the values since they are basically totals that I am accumulating. How do I update a specific value for a specific key? -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help with array handling

2007-04-12 Thread 7stud
loial wrote: > I am new to python and am converting an awk script to python > > I need to store some data in an array/table of some form > > keyvalue1, value1, value2, value3 > keyvalue2, value1,value2, value3 > keyvalue3, value1,value2,value3 > etc > > I will later need to sort in keyvalue order

Re: Newbie help with array handling

2007-04-12 Thread Bruno Desthuilliers
loial a écrit : > I am new to python and am converting an awk script to python > > I need to store some data in an array/table of some form > > keyvalue1, value1, value2, value3 > keyvalue2, value1,value2, value3 > keyvalue3, value1,value2,value3 > etc data = dict( keyvalue1=[value11, value12

Re: Newbie help with array handling

2007-04-12 Thread bearophileHUGS
loial: > I am new to python and am converting an awk script to python It seems there are many people trying to convert awk code to Python :-) > I need to store some data in an array/table of some form > keyvalue1, value1, value2, value3 > keyvalue2, value1,value2, value3 > keyvalue3, value1,valu

Re: Newbie help with array handling

2007-04-12 Thread bruce peng
use dir with list nested for example: {key1 : [value1, value2, value3], key2 : [value1, value2, vlaue4]} "loial" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am new to python and am converting an awk script to python > > I need to store some data in an array/table of some form

Re: Newbie help with array handling

2007-04-12 Thread rishi pathak
do something like this {keyvalue1:[ value1, value2, value3],keyvalue2:[value1,value2, value3],keyvalue3,:[value1,value2,value3]} On 12 Apr 2007 00:58:54 -0700, loial <[EMAIL PROTECTED]> wrote: I am new to python and am converting an awk script to python I need to store some data in an array/ta

Newbie help with array handling

2007-04-12 Thread loial
I am new to python and am converting an awk script to python I need to store some data in an array/table of some form keyvalue1, value1, value2, value3 keyvalue2, value1,value2, value3 keyvalue3, value1,value2,value3 etc I will later need to sort in keyvalue order and also need to be able to che

Re: Newbie help looping/reducing code

2007-02-19 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: >Lance Hoffmeyer <[EMAIL PROTECTED]> writes: >> def even_odd_round(num): >> if(round(num,2) + .5 == int(round(num,2)) + 1): >> if num > .5: >> if(int(num) % 2): >>

Re: Newbie help looping/reducing code

2007-02-19 Thread Paul Rubin
Lance Hoffmeyer <[EMAIL PROTECTED]> writes: > def even_odd_round(num): > if(round(num,2) + .5 == int(round(num,2)) + 1): > if num > .5: >if(int(num) % 2): > num = round(num,2) + .1 #an odd number >else: >

Re: Newbie help looping/reducing code

2007-02-19 Thread Paul Rubin
Lance Hoffmeyer <[EMAIL PROTECTED]> writes: > T2B = even_odd_round(float(str(T2B))) > VS = even_odd_round(float(str(VS))) > SS = even_odd_round(float(str(SS))) > sh.Cells(21,lastcol+1).Value = float(str(T2B))/100 > sh.Cells(22,lastcol+1).Value = float(str(VS))/100 > sh.Cells(23,lastcol+1).Va

Newbie help looping/reducing code

2007-02-19 Thread Lance Hoffmeyer
Hey all, Can someone help me reduce this code? It sure seems like there ought to be a way to loop this or combine things so that there is only 1 or 3 lines to this instead of 6. I've been scratching my head over this for a while though I can't come up with anything. Just as a note, I need even_

Re: search and replace in a file :: newbie help

2006-09-10 Thread techie2go
thanks , i got it -- http://mail.python.org/mailman/listinfo/python-list

Re: search and replace in a file :: newbie help

2006-09-09 Thread Peter Otten
techie2go wrote: > i m now updating an sql file > = > but the output is just > 2003-01-04 > and not > > insert into mobilebill values ('2003-01-04', 'OUT', '91804103253', 34, > 3.2); > > help me in this regard, what did i do wrong... You can find out yourself if you throw in so

search and replace in a file :: newbie help

2006-09-09 Thread techie2go
hi... i m now updating an sql file old file contains lines insert into mobilebill values ('Apr 01, 03', 'OUT', '91804103253', 34, 3.2); insert into mobilebill values ('Apr 01, 03', 'OUT', '91806392475', 84, 5.2); insert into mobilebill values ('Apr 01, 03', 'OUT', '918317048193', 76, 7.6); i want

Re: Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
Rob Wolfe wrote: >> This is my function: >> selecteddeptcodes = context.REQUEST.DEPTCODE >> currentstatus = context.REQUEST.STATUS >> >> if currentstatus == 'pending': >> for dptcd in selecteddeptcodes: >>context.changetolive(DEPTCODE=dptcd) >> if currentstatus == 'old': >> for dptcd in selec

Re: Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
Dennis Benzinger wrote: > Jonathan Bowlas wrote: >> Hi Listers, >> >> I have a requirement to test for a data type could someone tell me if >> this >> is possible in python? >> >> Basically I have a ZPT in Zope that users can select checkboxes in a form >> which pass arguments for a python function

Re: Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
John Machin wrote: > Jonathan Bowlas wrote: >> Hi Listers, >> >> I have a requirement to test for a data type could someone tell me if this >> is possible in python? >> >> Basically I have a ZPT in Zope that users can select checkboxes in a form >> which pass arguments for a python function, howeve

Re: [OT]Newbie help - test for data type

2006-07-31 Thread Bruno Desthuilliers
Jonathan Bowlas wrote: > Hi Listers, > > I have a requirement to test for a data type could someone tell me if this > is possible in python? > > Basically I have a ZPT in Zope that users can select checkboxes in a form > which pass arguments for a python function, however if there is only one > c

Re: Newbie help - test for data type

2006-07-31 Thread Rob Wolfe
> This is my function: > selecteddeptcodes = context.REQUEST.DEPTCODE > currentstatus = context.REQUEST.STATUS > > if currentstatus == 'pending': > for dptcd in selecteddeptcodes: >context.changetolive(DEPTCODE=dptcd) > if currentstatus == 'old': > for dptcd in selecteddeptcodes: >contex

Re: Newbie help - test for data type

2006-07-31 Thread Jonathan Bowlas
Thanks for everyone’s help, much appreciated, I’ll check out the isinstance function.   Jon   -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dennis Benzinger Sent: 31 July 2006 10:20 To: python-list@python.org Subject: Re: Newbie help - test

Re: Newbie help - test for data type

2006-07-31 Thread Dennis Benzinger
Jonathan Bowlas wrote: > Hi Listers, > > I have a requirement to test for a data type could someone tell me if this > is possible in python? > > Basically I have a ZPT in Zope that users can select checkboxes in a form > which pass arguments for a python function, however if there is only one > c

Re: Newbie help - test for data type

2006-07-31 Thread John Machin
Jonathan Bowlas wrote: > Hi Listers, > > I have a requirement to test for a data type could someone tell me if this > is possible in python? > > Basically I have a ZPT in Zope that users can select checkboxes in a form > which pass arguments for a python function, however if there is only one > che

Newbie help - test for data type

2006-07-31 Thread Jonathan Bowlas
Hi Listers, I have a requirement to test for a data type could someone tell me if this is possible in python? Basically I have a ZPT in Zope that users can select checkboxes in a form which pass arguments for a python function, however if there is only one checkbox selected it is passed as a stri

Re: Dictionaries -- ahh the fun.. (newbie help)

2006-05-10 Thread Gerard Flanagan
rh0dium wrote: > Hi all, > > Can someone help me out. I am trying to determing for each run whether > or not the test should pass or fail but I can't seem to access the > results .. > > Alternatively can someone suggest a better structure ( and a lesson as > to the reasoning ) that would be great

Re: Dictionaries -- ahh the fun.. (newbie help)

2006-05-09 Thread Bruno Desthuilliers
rh0dium a écrit : > Hi all, > > Can someone help me out. I am trying to determing for each run whether > or not the test should pass or fail but I can't seem to access the > results .. > (snip) > cells={} > > cells["NOR3X1"]= { > 'run' : [ 'lvs', 'drc' ], >

Re: Dictionaries -- ahh the fun.. (newbie help)

2006-05-09 Thread Scott David Daniels
rh0dium wrote: > Hi all, > > Can someone help me out. I am trying to determing for each run whether > or not the test should pass or fail but I can't seem to access the > results .. > > Alternatively can someone suggest a better structure ( and a lesson as > to the reasoning ) that would be grea

Re: Dictionaries -- ahh the fun.. (newbie help)

2006-05-09 Thread BJörn Lindqvist
> Can someone help me out. I am trying to determing for each run whether > or not the test should pass or fail but I can't seem to access the > results .. > > Alternatively can someone suggest a better structure ( and a lesson as > to the reasoning ) that would be great too!! Flat is better than

Re: Dictionaries -- ahh the fun.. (newbie help)

2006-05-09 Thread James Stroud
rh0dium wrote: > Hi all, > > Can someone help me out. I am trying to determing for each run whether > or not the test should pass or fail but I can't seem to access the > results .. > > Alternatively can someone suggest a better structure ( and a lesson as > to the reasoning ) that would be grea

Dictionaries -- ahh the fun.. (newbie help)

2006-05-09 Thread rh0dium
Hi all, Can someone help me out. I am trying to determing for each run whether or not the test should pass or fail but I can't seem to access the results .. Alternatively can someone suggest a better structure ( and a lesson as to the reasoning ) that would be great too!! cells={} cells["NOR3X

[newbie] help on audioop.rms()

2006-04-17 Thread Matte
Hi, I'm quite new to Python and I'm in need of help! I need to open an audio file, divide it into frame-based intervals and for each of those interval I have to analyze the sound level. audioop.rms() should do the trick, but I can't find a way to convert a frame interval (taken via readframes()

Re: Newbie Help!

2006-02-06 Thread bwaha
> 3. Any good ebooks or links to start with. (according to the web this is the > best place to start.) If you get the point of wantig to buy a book, I can recommend Python Visual Quickstart Guide by Chris Fhris Fehily as a very good text for beginners. I has helped me a lot. -- http://mail.py

Re: Newbie Help!

2006-02-05 Thread jmdeschamps
Alex Martelli wrote: > Stephen <[EMAIL PROTECTED]> wrote: > > > Hi All, > > im new to python i just have a few questions and was wondering if > > you could help me?? > > > > 1. what programming langaugue does python use? or which is most popular? > > Python _is_ a programming language, so

Re: Newbie Help!

2006-02-05 Thread Arthur Cannell
Stephen wrote: > Hi All, > im new to python i just have a few questions and was wondering if > you could help me?? > > 1. what programming langaugue does python use? or which is most popular? > > 2. Does anyone know where i could get hold of practice code > > 3. Any good ebooks or links

Re: Newbie Help!

2006-02-05 Thread Alex Martelli
Stephen <[EMAIL PROTECTED]> wrote: > Hi All, > im new to python i just have a few questions and was wondering if > you could help me?? > > 1. what programming langaugue does python use? or which is most popular? Python _is_ a programming language, so your question is not clear. If you'r

Newbie Help!

2006-02-05 Thread Stephen
Hi All, im new to python i just have a few questions and was wondering if you could help me?? 1. what programming langaugue does python use? or which is most popular? 2. Does anyone know where i could get hold of practice code 3. Any good ebooks or links to start with. (according to the

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-02 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > As while DSU is a very smart way to guard the max compare thing, it is > still being introduced as a way that is not related to the original > problem, i.e. I just want to compare f(x) And that's why in 2.5 you'll just code max(mylist, key=f) to express this int

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-02 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > Thanks. In that case, would it be easier to understand(beside the > original iterative loop) if I use reduce and lambda ? > You could try putting them side by side and seeing which is easiest for someone to understand: reduce(lambda (mv,mx), (v,x): mv > v and (mv,mx) o

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-02 Thread Bengt Richter
On 1 Dec 2005 05:45:54 -0800, "Niels L Ellegaard" <[EMAIL PROTECTED]> wrote: >I just started learning python and I have been wondering. Is there a >short pythonic way to find the element, x, of a list, mylist, that >maximizes an expression f(x). > >In other words I am looking for a short version o

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread bonono
Alex Martelli wrote: > <[EMAIL PROTECTED]> wrote: >... > > thanks. I don't know what max can or cannot compare. > > Just the same things that you can compare with, say, < . > > I believe in 2.5 max and min will also accept a key= argument (like > sorted etc) to tweak what to compare, so max(th

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > thanks. I don't know what max can or cannot compare. Just the same things that you can compare with, say, < . I believe in 2.5 max and min will also accept a key= argument (like sorted etc) to tweak what to compare, so max(thelist, key=f) should then work (but

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread bonono
Duncan Booth wrote: > wrote: > > >> In other words I am looking for a short version of the following: > >> > >> pair=[mylist[0],f(mylist[0])] > >> for x in mylist[1:]: > >> if f(x) > pair[1]: > >>pair=[x,f(x)] > > > > this is already very short, what else you want? May be this : >

Re: [[x,f(x)] for x in list that maximizes f(x)] <--newbie help

2005-12-01 Thread Duncan Booth
wrote: >> In other words I am looking for a short version of the following: >> >> pair=[mylist[0],f(mylist[0])] >> for x in mylist[1:]: >> if f(x) > pair[1]: >>pair=[x,f(x)] > > this is already very short, what else you want? May be this : > > max(((f(x), x) for x in mylist)) >

  1   2   >