Re: [Tutor] can't see emacs timer in action

2005-06-17 Thread Pujo Aji
Hello Max, the problem with running in a dos console terminal is that I have to switch back and forth from terminal and my xemacs. and I found that in windows dos console we have to specify buffer page. I do need a dynamic buffer control so I don't need to specify the buffer if my program run big

Re: [Tutor] can't see emacs timer in action

2005-06-17 Thread Pujo Aji
Hallo Danny, I tried the emacs folding customization, but it doesn't work. After I did it, my xemacs show tripple dot '...' near the method of class it should be folded. I don't know how to open my method. Sincerely Yours, pujo On 6/15/05, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Wed, 15

Re: [Tutor] can't see emacs timer in action

2005-06-17 Thread Pujo Aji
Hello Alan, thanks for the advice, but I don't understand why xemacs doesn't fix C-c C-c so we don't have to do such many things. in fact C-c C-c is fail to represent the well 'run' behaviour of python ? It would be nice to people who use python get the same benefit of typing C-c C-c and get the

Re: [Tutor] Checking if value exist in a '2D array'

2005-06-17 Thread Kent Johnson
Olli Rajala wrote: > Hi again, > > I have a '2D array', I mean a list inside a list ([[][],[][],...]) and > would need to check if the value exists in it. Of course I could do a > for loop, but that just seem to be a little overkill, so is there any > other way to do it? I have to check the first

[Tutor] max(len(item)) for cols

2005-06-17 Thread =?ISO-8859-1?Q?J=E1nos_Juh=E1sz?=
Dear Guys, I have a 2D array: >>>[['1', '2 ', '3'], ['longer ', 'longer', 'sort']] How can I get what is the max(len(item)) for the columns ? I would like to get a list with the max_col_width values. I hope that, it can wrote with some nice list comprehension, but I can't do that

Re: [Tutor] max(len(item)) for cols

2005-06-17 Thread Max Noel
On Jun 17, 2005, at 11:58, János Juhász wrote: > > Dear Guys, > > I have a 2D array: > [['1', '2 ', '3'], ['longer ', 'longer', 'sort']] > > > How can I get what is the max(len(item)) for the columns ? > I would like to get a list with the max_col_width values. > > I hope t

Re: [Tutor] max(len(item)) for cols

2005-06-17 Thread Kent Johnson
Max Noel wrote: > On Jun 17, 2005, at 11:58, János Juhász wrote: >>I have a 2D array: >> >> >[['1', '2 ', '3'], ['longer ', 'longer', 'sort']] > >> >> >>How can I get what is the max(len(item)) for the columns ? >>I would like to get a list with the max_col_width values. > > >

Re: [Tutor] max(len(item)) for cols

2005-06-17 Thread jfouhy
Quoting János Juhász <[EMAIL PROTECTED]>: > > Dear Guys, > > I have a 2D array: > >>>[['1', '2 ', '3 '], ['longer ', 'longer ', 'sort']] > > > How can I get what is the max(len(item)) for the columns ? > I would like to get a list with the max_col_width values. > > I hope that, it can wrote w

Re: [Tutor] max(len(item)) for cols

2005-06-17 Thread Kent Johnson
János Juhász wrote: > Dear Guys, > > I have a 2D array: > [['1', '2 ', '3'], ['longer ', 'longer', 'sort']] > > > > How can I get what is the max(len(item)) for the columns ? > I would like to get a list with the max_col_width values. > > I hope that, it can wrote with some n

Re: [Tutor] max(len(item)) for cols

2005-06-17 Thread János Juhász
Thanks Max, it is sort, but it gives back the max(len(item)) for the rows > I have a 2D array: > [['1', '2 ', '3'], ['longer ', 'longer', 'sort']] > > > How can I get what is the max(len(item)) for the columns ? > I would like to get a list with the max_col_width values. >

[Tutor] test

2005-06-17 Thread Asif Iqbal
Hi All I have a very simple problem and I am looking for the simplest solution. I have a list of elements in a file. I like to find the total occurance of each element in the list like this 10 string1 7 string2 1 string3 from a list which has only string1,string2 and string3 like this string1

Re: [Tutor] Checking if value exist in a '2D array'

2005-06-17 Thread Chad Crabtree
Kent Johnson wrote: >Olli Rajala wrote: > > >>Hi again, >> >>I have a '2D array', I mean a list inside a list ([[][],[][],...]) and >>would need to check if the value exists in it. Of course I could do a >>for loop, but that just seem to be a little overkill, so is there any >>other way to do it

Re: [Tutor] test

2005-06-17 Thread Chad Crabtree
How about this. >>> from random import choice >>> alist=[choice(range(100)) for x in range(1000)] #just making a list to look at pretend this is a file >>> >>> counter={} >>> for item in alist: ... if item in counter.keys(): ... counter[item]+=1 ... else: ... counter[i

Re: [Tutor] Checking if value exist in a '2D array'

2005-06-17 Thread Kent Johnson
Chad Crabtree wrote: > The second case you show should be true because I believe that's what > he > asked for. Here is I believe the correct way to do this. > > l= [ [1], [2,3], [4,5], [6]] def isin(test,alist): > > ... return bool([x for x in alist if test in x]) I don't think so,

Re: [Tutor] test

2005-06-17 Thread Asif Iqbal
On Fri, Jun 17, 2005 at 07:41:17AM, Chad Crabtree wrote: > How about this. > >>> from random import choice > >>> alist=[choice(range(100)) for x in range(1000)] #just making a How do I do this in python? alist < /tmp/logfile The logfile has the list of entries. -- Asif Iqbal PGP Key: 0xE6269

Re: [Tutor] max(len(item)) for cols

2005-06-17 Thread János Juhász
Thanks for jfouhy and Kent! Both the zip and the recipe are suit for me. I looked for these. Yours sincerely, __ János Juhász ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Clearing the Console Screen

2005-06-17 Thread Alan G
> > That having been said Fred Lundh has written a console module > > that tries to hide the diffeent trminal types in a common set > > of commands - you can download it from his site. > > The only one I can find there is for Windows: > http://www.effbot.org/zone/console-handbook.htm My bad. Y

Re: [Tutor] can't see emacs timer in action

2005-06-17 Thread Alan G
> but I don't understand why xemacs doesn't fix C-c C-c Neither do I. BTW Do you know if this is specific to xemacs? Or does it also apply to python mode in vanilla GNU emacs too? I really should get around to loading python-mode and trying it some day... Alan G. _

Re: [Tutor] max(len(item)) for cols

2005-06-17 Thread Alan G
I have a 2D array: >>>[['1', '2 ', '3'], ['longer ', 'longer', 'sort']] > How can I get what is the max(len(item)) for the columns ? > I would like to get a list with the max_col_width values. >>> tda = [['1', '2 ', '3'], ['longer ', 'longer', 'sort']] >>> mcw = [[len(r)

Re: [Tutor] test

2005-06-17 Thread Chad Crabtree
Asif Iqbal wrote: >On Fri, Jun 17, 2005 at 07:41:17AM, Chad Crabtree wrote: > > >>How about this. >> >>> from random import choice >> >>> alist=[choice(range(100)) for x in range(1000)] #just making a >> >> > >How do I do this in python? > alist < /tmp/logfile > >The logfile has the list of

[Tutor] Logging stdout and stderr

2005-06-17 Thread Connor . Smith
Hi there - I'm trying to log the results of a command that I'm running via the popen2 module to a file, while at the same time displaying its progress on the screen. So, at the end of the run, I should have the entire output (stdout and stderr) on the screen, but also have two file objects each

Re: [Tutor] can't see emacs timer in action

2005-06-17 Thread Pujo Aji
Before I use xemacs I use emacs and both are the same. I don't know if there is connection between cpython and problem in showing real time console, because both use cpython. I also want to hear people who use python and emacs/xemacs concerning this problem. pujo On 6/17/05, Alan G <[EMAIL PROTE

Re: [Tutor] Logging stdout and stderr

2005-06-17 Thread Hugo González Monteverde
Hi, Why don't you print it while you get it..? import os, sys logfile = open("logfile.txt", "r") input, output = os.popen2("your command") while True: temp = output.read(1) #or whatever fits you, more bytes is faster if not temp: //EOF reached break logfile.write(temp) sys.st