Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread lina
On Wed, Oct 5, 2011 at 1:42 PM, Dave Angel wrote: > On 10/04/2011 11:13 PM, lina wrote: > >> On Wed, Oct 5, 2011 at 10:45 AM, Dave Angel wrote: >> >> On 10/04/2011 10:22 PM, lina wrote: >>> >>> On Wed, Oct 5, 2011 at 1:30 AM, Prasad, Ramit>>> *com > w > >>> SyntaxError:

Re: [Tutor] fake defrag revisited

2011-10-04 Thread Dave Angel
On 10/01/2011 03:53 PM, R. Alan Monroe wrote: You missed the rest of the paragraph. Don't wait for the sort to finish, you do the swapping in the compare function. Either I'm too dumb to understand your answer, or explained my original problem too poorly. Have you ever played the Rush Hour

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread Andreas Perstinger
On 2011-10-05 05:13, lina wrote: $ python3 counter-vertically.py ^^^ File "counter-vertically.py", line 20 print item ^ SyntaxError: invalid syntax In Python 3 print is a function: print(item) In another message in this thread you've said: "Sorry, I am still lac

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread Dave Angel
On 10/04/2011 11:13 PM, lina wrote: On Wed, Oct 5, 2011 at 10:45 AM, Dave Angel wrote: On 10/04/2011 10:22 PM, lina wrote: On Wed, Oct 5, 2011 at 1:30 AM, Prasad, Ramit w SyntaxError: invalid syntax for fileName in os.listdir("."): if os.path.isfile(fileName) and os.path.splitext(

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread lina
On Wed, Oct 5, 2011 at 10:45 AM, Dave Angel wrote: > On 10/04/2011 10:22 PM, lina wrote: > >> On Wed, Oct 5, 2011 at 1:30 AM, Prasad, >> Ramit >> >wrote: >> >> But I still don't know how to get the statistic result of each column, >>> Thanks. >>> try: >>>cols = len( text[0] ) # Fi

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread Dave Angel
On 10/04/2011 10:22 PM, lina wrote: On Wed, Oct 5, 2011 at 1:30 AM, Prasad, Ramitwrote: But I still don't know how to get the statistic result of each column, Thanks. try: cols = len( text[0] ) # Find out how many columns there are (assuming each row has the same number of columns) except

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread lina
On Wed, Oct 5, 2011 at 1:30 AM, Prasad, Ramit wrote: > >But I still don't know how to get the > >statistic result of each column, > > Thanks. > > try: >cols = len( text[0] ) # Find out how many columns there are (assuming > each row has the same number of columns) > except IndexError: >ra

Re: [Tutor] String switch

2011-10-04 Thread bob gailer
Please always reply-all so a copy goes to the list. I'm forwarding this one for you. Please answer ALL questions that we ask. You did not answer What do you mean by "all other strings"? On 10/4/2011 4:55 PM, Christopher King wrote: This is (to me) vague. What do you mean by "at the top"

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread Alan Gauld
On 04/10/11 18:09, lina wrote: But I still don't know how to get the statistic result of each column, Let's ignore the traversal of files issue for now. Let's look at processing one file: You want a list of totals of equal length to the number of columns. We can find that number using len(line

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread Alan Gauld
On 04/10/11 17:38, lina wrote: For file: aaEbb aEEbb EaEbb EaEbE the expected output is 2 1 0 1 I expected 2 1 4 0 1 In the first column there is 2 E, so the output is 2 E, second column is 1 E. But the 3rd is all E so why miss out the 4? I'm still confused - and I thought I was gettin

[Tutor] extract information from txtfile

2011-10-04 Thread Anna Olofsson
Hi, I'm a beginner at Python and I'm trying to extract some information from a textfile where I have a lot of data. The table looks something like this, but with many more columns and rows: # chr Pos ID REFALT . . . . . . . . . . . 1 13645 -

Re: [Tutor] What is the difference between the now depreciated threading module and the multiprocessing module

2011-10-04 Thread Prasad, Ramit
>I was wondering if anyone could tell me why threading was depreciated; and >give me a use case for the >multiprocessing : Queue function in python 2.7. Threading was *not* deprecated Python 2.x or 3.x http://docs.python.org/dev/py3k/library/threading.html?highlight=threading#threading http://

[Tutor] What is the difference between the now depreciated threading module and the multiprocessing module

2011-10-04 Thread Earnest Gildon
I was wondering if anyone could tell me why threading was depreciated; and give me a use case for the multiprocessing : Queue function in python 2.7. Thanks, -earnest ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread Dave Angel
On 10/04/2011 01:09 PM, lina wrote: But I still don't know how to get the statistic result of each column, Thanks for further suggestions, Best regards, lina As I said before, your current code counts across a line at a time, while you need to count vertically. That could be done by transpo

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread Prasad, Ramit
>But I still don't know how to get the >statistic result of each column, try: cols = len( text[0] ) # Find out how many columns there are (assuming each row has the same number of columns) except IndexError: raise # This will make sure you can see the error while developing;

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread lina
But I still don't know how to get the statistic result of each column, Thanks for further suggestions, Best regards, lina ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tut

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread lina
On Wed, Oct 5, 2011 at 12:59 AM, Marc Tompkins wrote: > On Tue, Oct 4, 2011 at 8:48 AM, lina wrote: > >> if os.path.isfile(fileName) and os.path.splitext(fileName)[1]==".xpm": >> filedata = open(fileName) >> text=filedata.readlines() >> for line in text[0:]: >>

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread Marc Tompkins
On Tue, Oct 4, 2011 at 8:48 AM, lina wrote: > if os.path.isfile(fileName) and os.path.splitext(fileName)[1]==".xpm": > filedata = open(fileName) > text=filedata.readlines() > for line in text[0:]: > result.append({t:line.strip().count(t) for t in tokens}) >

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread lina
For file: aaEbb aEEbb EaEbb EaEbE the expected output is 2 1 0 1 In the first column there is 2 E, so the output is 2 E, second column is 1 E. #!/bin/python import os.path tokens=['B','E'] for fileName in os.listdir("."): result=[] if os.path.isfile(fileName) and os.path.splitext(f

Re: [Tutor] arrary stastic

2011-10-04 Thread lina
On Wed, Oct 5, 2011 at 12:26 AM, Dave Angel wrote: > On 10/04/2011 12:01 PM, bob gailer wrote: > >> On 10/4/2011 10:07 AM, lina wrote: >> >>> want to do a statistic of the concurrence of E, >>> >>>namely, >>>how many times the E showed up, >>> >>>so the first column is 1, second colum

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread Dave Angel
On 10/04/2011 10:26 AM, lina wrote: On Thu, Sep 29, 2011 at 11:28 PM, Dave Angel wrote: (Please don't top-post. Put your remarks AFTER the part you're quoting from the previous message) On 09/29/2011 10:55 AM, lina wrote: import os.path tokens=['E'] result=[] for fileName in os.listdir(

Re: [Tutor] arrary stastic

2011-10-04 Thread Dave Angel
On 10/04/2011 12:01 PM, bob gailer wrote: On 10/4/2011 10:07 AM, lina wrote: want to do a statistic of the concurrence of E, namely, how many times the E showed up, so the first column is 1, second column and then following. Thanks, I have one, which showed something like

Re: [Tutor] arrary stastic

2011-10-04 Thread bob gailer
On 10/4/2011 10:07 AM, lina wrote: want to do a statistic of the concurrence of E, namely, how many times the E showed up, so the first column is 1, second column and then following. Thanks, I have one, which showed something like: tokens=['E'] result=[] fi

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread lina
On Tue, Oct 4, 2011 at 11:27 PM, Dave Angel wrote: > On 10/04/2011 10:26 AM, lina wrote: > >> On Thu, Sep 29, 2011 at 11:28 PM, Dave Angel wrote: >> >> (Please don't top-post. Put your remarks AFTER the part you're quoting >>> from the previous message) >>> >>> >>> On 09/29/2011 10:55 AM, lina

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread lina
On Thu, Sep 29, 2011 at 11:28 PM, Dave Angel wrote: > (Please don't top-post. Put your remarks AFTER the part you're quoting > from the previous message) > > > On 09/29/2011 10:55 AM, lina wrote: > >> import os.path >> >> tokens=['E'] >> result=[] >> >> for fileName in os.listdir("."): >> if

Re: [Tutor] arrary stastic

2011-10-04 Thread lina
On Tue, Oct 4, 2011 at 10:03 PM, lina wrote: > > > On Tue, Oct 4, 2011 at 8:51 PM, wrote: > >> I don't understand what you want >> >> Mayybe give expected output as well >> > > want to do a statistic of the concurrence of E, > namely, > how many times the E showed up, > > so the first column is

Re: [Tutor] arrary stastic

2011-10-04 Thread lina
On Tue, Oct 4, 2011 at 8:51 PM, wrote: > I don't understand what you want > > Mayybe give expected output as well > want to do a statistic of the concurrence of E, namely, how many times the E showed up, so the first column is 1, second column and then following. Thanks, I have one, which sho

Re: [Tutor] arrary stastic

2011-10-04 Thread eire1130
I don't understand what you want Mayybe give expected output as well Sent from my Verizon Wireless BlackBerry -Original Message- From: lina Sender: tutor-bounces+eire1130=gmail@python.org Date: Tue, 4 Oct 2011 19:44:02 To: tutor Subject: [Tutor] arrary stastic ___

[Tutor] arrary stastic

2011-10-04 Thread lina
Hi, For a file with aaE aEE EaE I want to statically get the concurence of E, such as for coloumn 1, I wish it print a[0]=1, a[1]=1,a[2]=3. Thanks for suggestions, -- Best Regards, lina ___ Tutor maillist - Tutor@python.org To unsubscribe or ch