Re: [Tutor] help with running perl script that writes to a text file

2013-02-05 Thread Alan Gauld
On 05/02/13 23:44, 3n2 Solutions wrote: I want to automate the following manual process from DOS promp: c:/scripts/perl>perl fix.pl base.gtx >base.txt Use a DOS batch file, that's what they are there for. If you are not doing any other processing Python is inefficient and overkill for this

Re: [Tutor] Getting range of a list

2013-02-05 Thread Alan Gauld
On 05/02/13 23:59, Hs Hs wrote: Thanks Dave. Sorry for html formatting. Honestly I don't know how to shut html formatting off in Yahoo. Create a new message. Look at the bar just below the subject box, it has some tabs in it. At the extreme right end there is a button marked Switch to Plain

Re: [Tutor] Getting range of a list

2013-02-05 Thread Hs Hs
Thanks Dave.  Sorry for html formatting. Honestly I don't know how to shut html formatting off in Yahoo. I don't have options for send in ('Tools|Options|''send''missing'). Will investigate.  thanks Hs From: Dave Angel To: tutor@python.org Sent: Tuesday, Fe

[Tutor] help with running perl script that writes to a text file

2013-02-05 Thread 3n2 Solutions
Hello, I want to automate the following manual process from DOS promp: c:/scripts/perl>perl fix.pl base.gtx >base.txt Here is my python script: path="c:/scripts/perl/" subprocess.call(['perl','fix.pl','base.gtx >base.txt',path]) I also tried this alternative: subprocess.Popen(['perl','fix.pl'

Re: [Tutor] Getting range of a list

2013-02-05 Thread Dave Angel
On 02/05/2013 04:48 PM, Hs Hs wrote: Thanks Steve. But one question, when I print, I get extra empty lines. How to get rid of them! Thanks again. f = open('test') head = '---' for line in f: line = line.rstrip() #get rid of the trailing newline (and any other whitespace there) if li

Re: [Tutor] Getting range of a list

2013-02-05 Thread Hs Hs
Thanks Steve.  But one question, when I print, I get extra empty lines. How to get rid of them!  Thanks again. >>> f = open('test') >>> head = '---' >>> for line in f: if line.startswith('>'): head = line[1:].strip() else: print head+'\t'+line X1A                         <-- X1G            

Re: [Tutor] Getting range of a list

2013-02-05 Thread Dave Angel
On 02/05/2013 04:08 PM, Hs Hs wrote: First comment: do NOT post in html, as it frequently messes up indenting. Send your email in text mode, as this is a text mailing list. Compounding that, you apparently are running inside some shell program (pyshell ?) which is doing a further mess.

Re: [Tutor] Iterating a dict with an iteration counter? How would *you* do it?

2013-02-05 Thread Steven D'Aprano
On 05/02/13 22:27, Oscar Benjamin wrote: On 5 February 2013 03:56, eryksun wrote: On Mon, Feb 4, 2013 at 7:04 PM, Dave Angel wrote: Nope, in both Python 2 and 3 iterating over a dict directly just provides the key. That's also how "if key in dict" works. A dict implements __contains__ for a

Re: [Tutor] Getting range of a list

2013-02-05 Thread Steven D'Aprano
On 06/02/13 08:08, Hs Hs wrote: Here is what I do : f1 = open('test','r') da = f1.read().split('\n') dat = da[:-1] dat mpos = [] for i in range(len(dat)): if dat[i].startswith('>'): mpos.append(i) mpos [0, 3, 6, 9] for item in range(len(mpos)): start = mpos[item] enda = item+1 end =

[Tutor] Getting range of a list

2013-02-05 Thread Hs Hs
Dear List members: I always have problem in getting ranges: Following is my representation of part of my file. >X1 A G C G >X2 A G >X3 A G >X4 H T I want to print the above contents in the following way: X1 \t A X1 \t G X1 \t C X1 \t G X2 \t A X2 \t G X3 \t A X3 \t G X4 \t H X4 \t H Here

Re: [Tutor] How to create a GUI for python using tkinter

2013-02-05 Thread Alan Gauld
On 05/02/13 09:38, Aaron Misquith wrote: 2.Is there a way to automate getting access tokens for the user that is logging in? If not how to get access tokens for each user while logging in? No idea, you'll need to ask on a Facebook programming list. This one only deals with Python programming

Re: [Tutor] Help- Regarding python

2013-02-05 Thread Oscar Benjamin
On 5 February 2013 05:08, eryksun wrote: > On Mon, Feb 4, 2013 at 7:21 PM, Oscar Benjamin > wrote: >> eigenvalues, eigenvectors = np.linalg.eig(C) > > First sort by eigenvalue magnitude: > > >>> idx = np.argsort(eigenvalues)[::-1] > >>> print idx > [ 0 1 2 3 8 10 11 12 14 22 20 21

Re: [Tutor] How to create a GUI for python using tkinter

2013-02-05 Thread Walter Prins
Hi On 5 February 2013 09:38, Aaron Misquith wrote: >> >>> I have attached a python program with this mail which peforms following >>> operations: >>> 1.Logs in to facebook. >>> 2.Asks the user for access tokens. >>> 3.Gets the friend list of the user. >>> 4.outputs the friend list as pdf. >>> >

[Tutor] Fwd: How to create a GUI for python using tkinter

2013-02-05 Thread Walter Prins
Forwarding (presumed accidental) personal reply back to list. -- Forwarded message -- From: Aaron Misquith Date: 5 February 2013 13:01 Subject: Re: [Tutor] How to create a GUI for python using tkinter To: Walter Prins On Tue, Feb 5, 2013 at 5:40 PM, Walter Prins wrote: > On

Re: [Tutor] nose, git, post-commit hook

2013-02-05 Thread Albert-Jan Roskam
> On 4 February 2013 15:32, Albert-Jan Roskam wrote: >> I am using git VCS and I read about the possibility to use post-commit > hooks for nose tests. That sounds pretty cool, but does this also have > disadvantages? >> It would be very annoying if I couldn't check in code, safely tucked > aw

Re: [Tutor] Iterating a dict with an iteration counter? How would *you* do it?

2013-02-05 Thread eryksun
On Tue, Feb 5, 2013 at 6:27 AM, Oscar Benjamin wrote: > > I almost wrote this response but then I realised that Dave probably > meant that "obj in dict" returns True if the dict has a key equal to > obj rather than if the dict has a (key, value) pair equal to obj. Thanks, that's probably what Ste

Re: [Tutor] Iterating a dict with an iteration counter? How would *you* do it?

2013-02-05 Thread Oscar Benjamin
On 5 February 2013 03:56, eryksun wrote: > On Mon, Feb 4, 2013 at 7:04 PM, Dave Angel wrote: >>> Nope, in both Python 2 and 3 iterating over a dict directly just >>> provides the key. That's also how "if key in dict" works. > > A dict implements __contains__ for an efficient "in" test. In general

[Tutor] How to create a GUI for python using tkinter

2013-02-05 Thread Aaron Misquith
I have attached a python program with this mail which peforms following operations: 1.Logs in to facebook. 2.Asks the user for access tokens. 3.Gets the friend list of the user. 4.outputs the friend list as pdf. My Problems regarding the above program are: 1.I want to display the names of my frien