Re: [Tutor] Tutor Digest, Vol 25, Issue 54

2006-03-22 Thread Keo Sophon
On Wednesday 22 March 2006 14:14, [EMAIL PROTECTED] wrote: > Hi Sophon, > > You may want to look at: > > http://wiki.python.org/moin/BeginnersGuide/NonProgrammers > > Many of the tutorials there talk about reading from files, including Alan > Gauld's "How to Program": > > http://www.freen

Re: [Tutor] Hi

2006-03-22 Thread Suri Chitti
It would be "ercal". The first number n denotes the position where we start. The first position is always zero. So 3 would be the letter at the 4th position which is e. The second number is I guess what confused you. m denotes where we end, counted the same way but by having 1 for the first p

Re: [Tutor] Tutor Digest, Vol 25, Issue 54

2006-03-22 Thread Keo Sophon
On Wednesday 22 March 2006 14:14, [EMAIL PROTECTED] wrote: > Hi Sophon, > > Secondary question: why are you trying to do this? Are you trying to > represent a collection or "array" of things? i am trying to port a program written in C to python language. The program is reading a plain text file

Re: [Tutor] how to get a line text from input file.

2006-03-22 Thread Alan Gauld
> i am new to programming language and python. I wonder how to get a line > text > from input file. f = open('somefile.txt') line = f.readline() For more details on using files see the Handling Files topic in my web tutor. Alan G Author of the learn to program web tutor http://www.freenetpages

Re: [Tutor] how to set a value to a block of memory

2006-03-22 Thread Alan Gauld
> How can i set a value to a bytes of block of memory. In C, i think they > use > memset like this. Python is a high level programming language and does not support direct memory access in the way that C does. Can you explain why you think you need to do this? Is it essential to access a specifi

Re: [Tutor] Hi

2006-03-22 Thread Alan Gauld
> I got this, Lets say if its mystring[n:m] where n may be another > number and m may be another number so how will it work in that case, > so this becomes general and makes more clear > n is the index of the first character and m is the index *beyond* the last character > Lets say if its mystrin

Re: [Tutor] Hi

2006-03-22 Thread Kaushal Shriyan
On 3/22/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > > I got this, Lets say if its mystring[n:m] where n may be another > > number and m may be another number so how will it work in that case, > > so this becomes general and makes more clear > > > n is the index of the first character and m is the i

Re: [Tutor] Tutor Digest, Vol 25, Issue 54

2006-03-22 Thread Kent Johnson
Keo Sophon wrote: > Anyway, how can i declare a global variable and assign a value to it in a > function? The usual way to do this is to return a value from the function and assign it to the variable. For example: def double(x): return x*2 x=2 doublex = double(x) You really should look at

Re: [Tutor] Hi

2006-03-22 Thread Alan Gauld
> It helps to think of the indices as pointing to in between the letters. > Not to the letters themselves. Like so, where '|' represents the mark: 'corrupt'[0:] -> '|corrupt' 'corrupt'[1:] -> 'c|orrupt' So an index of 1 moves the mark one place up. > Negative indices start from the position s

Re: [Tutor] Tutor Digest, Vol 25, Issue 54

2006-03-22 Thread Alan Gauld
> Anyway, how can i declare a global variable and assign a value to it in a > function? Variables in Python are only global in the sense of a file. You cannot declare a global that spans multiple files. However you can import a variable reference from one file to another. This is "A Good Thing(

[Tutor] Simple way for i18n ?

2006-03-22 Thread francois schnell
Hello all,I wish to translate a Python script from English to French. I've read the offical documentation (python.org doc) but I must admit that I'm lost now ...I've found some simple explanations here but I can't make it work: http://karrigell.sourceforge.net/en/internationalization.htmHere's wher

Re: [Tutor] Simple way for i18n ?

2006-03-22 Thread Andre Roberge
On 3/22/06, francois schnell <[EMAIL PROTECTED]> wrote: > > Hello all, > > I wish to translate a Python script from English to French. I've read the > offical documentation (python.org doc) but I must admit that I'm lost now > ... > I've found some simple explanations here but I can't make it work:

[Tutor] i need help please read

2006-03-22 Thread Tom Bachik
ok does anyone know how to righ a script were a box pops up then if it goes over a number on the screen it pops up in the box become the input number so you can alter the number that popped up in the box? if you do can you right it and send it to me and  if you cant doit all but know how i can do p

[Tutor] html and mod_python

2006-03-22 Thread Patty
Hi! I created a form in a python file that takes values selected from 6 different drop down boxes: for target in all_targets: s = s + "" s = s + "" % target s = s + "" for host in hosts: if target in ants_map[host]: s = s + printbox()

[Tutor] efficient method to search between two lists

2006-03-22 Thread Srinivas Iyyer
Dear group, I have a question for solving a problem in more simplistic and efficient way. I have two lists: list_a = ['S83513\tNM_001117', 'X60435\tNM_001117', 'U75370\tNM_005035', 'U05861\tNM_001353', 'S68290\tNM_001353', 'D86864\tNM_145349', 'D86864\tNM_003693', 'D86864\tNM_145351', 'D63483\t

[Tutor] urlopen: where are the results?

2006-03-22 Thread Kermit Rose
Anybody care to comment on the following? >>> from urllib2 import * >>> urlopen("http://www.kermitrose.com";) > >>> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] efficient method to search between two lists

2006-03-22 Thread Danny Yoo
> Although dictionary is superfast, due to duplications > in both columns of list_a, a dictionary option falls > out. Hi Srinivas, A dictionary method can work perfectly well. The assumption that I think is being made is that dictionary values are restricted to single values. But dictionaries a

Re: [Tutor] urlopen: where are the results?

2006-03-22 Thread Danny Yoo
On Wed, 22 Mar 2006, Kermit Rose wrote: > Anybody care to comment on the following? > > >>> from urllib2 import * Don't do this. *grin* Using 'from [modulename] import *' is not so good in Python because there's no warning if one of the contents in the module is overriding an existing definit

Re: [Tutor] i need help please read

2006-03-22 Thread Danny Yoo
On Wed, 22 Mar 2006, Tom Bachik wrote: > ok does anyone know how to righ a script were a box pops up then if it > goes over a number on the screen it pops up in the box become the input > number so you can alter the number that popped up in the box? if you do > can you right it and send it to me

Re: [Tutor] efficient method to search between two lists

2006-03-22 Thread Terry Carroll
On Wed, 22 Mar 2006, Srinivas Iyyer wrote: > I cannot think of any other smart method since these > are the only two ways I know possible. > > Would any one please help me suggesting a neat and > efficient way. I'm thinking: 1) use sets to get subsets of both lists down to only those element

Re: [Tutor] html and mod_python

2006-03-22 Thread Adam Cripps
On 3/23/06, Patty <[EMAIL PROTECTED]> wrote: > Hi! > > I created a form in a python file that takes values selected from 6 different > drop down boxes: > > for target in all_targets: >s = s + "" >s = s + "" % target >s = s + "" >for host in hosts: >if tar

[Tutor] basic question

2006-03-22 Thread michel maho
Hello everybody, I loaded IDLE (python GUI) on my portable installed with Windows XPpro but when I go in Python shell to file, and New wondow ,I do not find run or execute or something like that. I suppose the link with with WSH is not made. Please can and will anybody help a seventy one yea

Re: [Tutor] efficient method to search between two lists

2006-03-22 Thread Srinivas Iyyer
Hi Danny, Thanks for reminding me the tip from Kent :-) da = {} for m in list_a: cols = m.split('\t') ter = cols[0] da.setdefault(ter,[]).append(m) >>> da {'S66427': ['S66427\tNM_002892'], 'U05861': ['U05861\tNM_001353'], 'D63483': ['D63483\tNM_145349', 'D63483\tNM_003693',

Re: [Tutor] efficient method to search between two lists

2006-03-22 Thread Srinivas Iyyer
Thank you Terry, I learned some stuff from your snippet. I used 'Set' but never got to use its power using LC. Thanks again Srini --- Terry Carroll <[EMAIL PROTECTED]> wrote: > On Wed, 22 Mar 2006, Srinivas Iyyer wrote: > > > I cannot think of any other smart method since > these > > are