Re: [Tutor] tree/node class/module

2008-01-15 Thread cedric briner
usefull page > http://www.velocityreviews.com/forums/t355467-tree-and-graph-structures-in-python.html > thanks again Ced. -- Cedric BRINER Geneva - Switzerland ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo

Re: [Tutor] get_python_lib()

2008-01-15 Thread Vishnu Mohan
Kakada wrote: > Hi list, > > I was just wondering why the below function return different location on > different machine? > > import distutils.sysconfig > distutils.sysconfig.get_python_lib() > On my computer: > '/usr/lib/python2.5/site-packages' > On my friend's computer: > '/usr/local/lib/pytho

[Tutor] parsing html.

2008-01-15 Thread Shriphani Palakodety
Hello, I have a html document here which goes like this: Table of Contents . Preface Can someone tell me how I can get the string between the tag for an a tag for a given value of the name attribute. Thanks, Shriphani Palakodety ___ Tutor mail

Re: [Tutor] help, thanks very much.

2008-01-15 Thread Brendan Rankin
bill.wu gmail.com> writes: > > > > i am new guy. > i ask a easy question. > > why the first one have"x",the second one doesn't have "x". what > is different? when write "x",when don't write "x". > > in my point,the second one don't def variable. > > Variable scope. By declaring the

[Tutor] get_python_lib()

2008-01-15 Thread Kakada
Hi list, I was just wondering why the below function return different location on different machine? import distutils.sysconfig distutils.sysconfig.get_python_lib() On my computer: '/usr/lib/python2.5/site-packages' On my friend's computer: '/usr/local/lib/python2.5/site-packages' What is the

[Tutor] help, thanks very much.

2008-01-15 Thread bill.wu
i am new guy. i ask a easy question. why the first one have"x",the second one doesn't have "x". what is different? when write "x",when don't write "x". in my point,the second one don't def variable. (1) def func(x): print 'x is', x x = 2 print 'Changed local x to', x x = 50 func

[Tutor] A faster x in S

2008-01-15 Thread Danny Yoo
Kent and Bob, Are you thinking of the first problem in Bentley's Programming Pearls? The original poster's questions sounds like it could be in that domain. http://netlib.bell-labs.com/cm/cs/pearls/cto.html So I agree: the next questions we probably should ask the original poster: * W

Re: [Tutor] Input

2008-01-15 Thread Tiger12506
> Of course I know and use reg. exps., the point of the function is not to > validate input but to force the proper input. So? Are you going to try to tell me that you can force particular input without actually determining if its valid or not first? ;-) Just a thought. ___

Re: [Tutor] Input

2008-01-15 Thread Kent Johnson
Ricardo Aráoz wrote: > _validChars = { > 'X' : > 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' > , '9' : '1234567890' > , '-' : '-1234567890' > , 'A' : > 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' >

Re: [Tutor] Rs: help, thanks very much.

2008-01-15 Thread Eric Brunson
Did you read the entire discussion at http://www.ibiblio.org/g2swap/byteofpython/read/local-variables.html? What did you understand and not understand? Sincerely, e. bill.wu wrote: > i am new guy. > i ask a easy question. > why the first one have"x",the second one doesn't have "x". what is > di

[Tutor] Rs: help, thanks very much.

2008-01-15 Thread bill.wu
i am new guy. i ask a easy question. why the first one have"x",the second one doesn't have "x". what is different? when write "x",when don't write "x". in my point,the second one don't def variable. (1) def func(x): print 'x is', x x = 2 print 'Changed local x to', x x = 50 func(

Re: [Tutor] Input

2008-01-15 Thread Ricardo Aráoz
Tiger12506 wrote: > Try regular expressions in the re module. This should make this code below > much much simpler. Downside is you have to learn a slightly different > syntax. Upside is - regular expressions are very powerful. > Of course I know and use reg. exps., the point of the function is

Re: [Tutor] Input

2008-01-15 Thread Tiger12506
Try regular expressions in the re module. This should make this code below much much simpler. Downside is you have to learn a slightly different syntax. Upside is - regular expressions are very powerful. > Last week someone had an issue with raw_input() and how to get input for > a number. So

Re: [Tutor] Reading Input Data

2008-01-15 Thread Michael Langford
I'd like to be clear, this isn't a clean thing for the middle of a big program. I was thinking the entire time I was testing it "I wonder why anyone would need to do this" But if you have a python program you'd probably call a script, used for one simple task, it can be appropriate (with Kent'

Re: [Tutor] A faster x in S

2008-01-15 Thread bob gailer
Dinesh B Vadhia wrote: > For some significant data pre-processing we have to perform the > following simple process: > > Is the integer x in a list of 13K sorted integers. That's it except > this has to be done >100m times with different x's (multiple times). > Yep, a real pain! > > I've

Re: [Tutor] tree/node class/module

2008-01-15 Thread bob gailer
cedric briner wrote: > hello, > > I'm wanting to do a GUI for to help people using rsync, du, tar . it > will provide the --exclude and --include of them. > > And I thought that the best way to store data relative to the hierarchy > filesystem was to store them in a tree structure. But after brow

Re: [Tutor] Reading Input Data

2008-01-15 Thread bob gailer
lechtlr wrote: > I want to read an input file (file.csv) that has two columns. I want > to read 2nd column and assign variables that are strings and floats. > Currently, I use the following split() function to read from the input > file and create a list, and then assign each element to a variab

[Tutor] Input

2008-01-15 Thread Ricardo Aráoz
Last week someone had an issue with raw_input() and how to get input for a number. So I remembered my CP/M times and got to think of a little function I had there. The function is lost and my time is scarce but I made a little effort and here you have the results. It has loads of room for improveme

Re: [Tutor] Reading Input Data

2008-01-15 Thread Kent Johnson
Michael Langford wrote: > for subscript,line in enumerate(file("file.csv")): > s = line.split(",")[1] > try: >f = float(s) >locals()["x%i" % subscript]=f > except: >locals()["x%i" % subscript]=s Don't do this! For one thing, writing to locals() d

Re: [Tutor] Reading Input Data

2008-01-15 Thread Michael Langford
Accidentally cut off a 0 there... Think about using ConfigParser instead of your csv. Doug Hellman wrote a good article on that: http://blog.doughellmann.com/2007/04/pymotw-configparser.html But if you really want to load your data this way, this will work: for subscript,line in enumerate(file("f

Re: [Tutor] Reading Input Data

2008-01-15 Thread Michael Langford
for subscript,line in enumerate(file("file.csv")): s = line.split(",")[1] try: f = float(s) locals()["x%i" % subscript]=f except: locals()["x%i" % subscript]=s print x1 print x On Jan 15, 2008 3:26 PM, lechtlr <[EMAIL PROTECTED]> wrote: > I wa

Re: [Tutor] Reading Input Data

2008-01-15 Thread Kent Johnson
lechtlr wrote: > I want to read an input file (file.csv) that has two columns. I want to > read 2nd column and assign variables that are strings and floats. > Currently, I use the following split() function to read from the input > file and create a list, and then assign each element to a variab

Re: [Tutor] Reading Input Data

2008-01-15 Thread jay
Python has a cvs module that will make this slightly more elegant http://docs.python.org/lib/module-csv.html j On Jan 15, 2008 2:26 PM, lechtlr <[EMAIL PROTECTED]> wrote: > I want to read an input file (file.csv) that has two columns. I want to > read 2nd column and assign variables that are st

[Tutor] Reading Input Data

2008-01-15 Thread lechtlr
I want to read an input file (file.csv) that has two columns. I want to read 2nd column and assign variables that are strings and floats. Currently, I use the following split() function to read from the input file and create a list, and then assign each element to a variable. I am wondering th

Re: [Tutor] A faster x in S

2008-01-15 Thread Kent Johnson
Dinesh B Vadhia wrote: > For some significant data pre-processing we have to perform the > following simple process: > > Is the integer x in a list of 13K sorted integers. That's it except > this has to be done >100m times with different x's (multiple times). > Yep, a real pain! > > I've

[Tutor] tree/node class/module

2008-01-15 Thread cedric briner
hello, I'm wanting to do a GUI for to help people using rsync, du, tar . it will provide the --exclude and --include of them. And I thought that the best way to store data relative to the hierarchy filesystem was to store them in a tree structure. But after browsing ages on the web, I didn't f

[Tutor] A faster x in S

2008-01-15 Thread Dinesh B Vadhia
For some significant data pre-processing we have to perform the following simple process: Is the integer x in a list of 13K sorted integers. That's it except this has to be done >100m times with different x's (multiple times). Yep, a real pain! I've put the 13K integers in a list S and am u

Re: [Tutor] MySQLdb install issue

2008-01-15 Thread Eric Brunson
There is at least on client library that the mysql package needs to link against. You either need to install the libraries on the client machine or else build the package statically linked on the server machine and move it over prebuilt. John wrote: > Hello, > > Does anyone know how to inst

Re: [Tutor] Read protection of python files for Abaqus

2008-01-15 Thread Ferruh KAYHAN
Dear Sir; Thank you very much for the information. After I read your e-mail, I have started to think that our codes are not highly but moderately valuable. Therefore, I am satisfied, by using .pyc files. I am not very affraid of determined hackers from outside because they will not understand th

[Tutor] MySQLdb install issue

2008-01-15 Thread John
Hello, Does anyone know how to install MySQLdb into a python installation when the machine you are working on does not have MySQL installed? I.E. the MySQL installation is on a different server, but the site.cfg file for the MySQLdb installation asks for the location of the mysql_config: " # The