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
gel
To: tutor@python.org
Sent: Tuesday, February 5, 2013 5:20 PM
Subject: Re: [Tutor] Getting range of a list
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.
>>>&
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
rint head+'\t'+line
X1A
<--
X1G
<-
X2A
X2G
X3A
X3G
X4A
X4A
Thanks
Hs.
From: Steven D'Aprano
To: tutor@python.org
Sent: Tuesday, February 5, 2013 4:28 PM
Subject: Re: [Tutor] Getting range
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.
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 =
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