<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Thanks Dave. </div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">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 (<span style="font-family: tahoma, verdana, arial, sans-serif; font-size: 12px;">'Tools|Options|''send''missing').</span></div><div style="color: rgb(0, 0, 0); font-size: 12px; font-family: tahoma, verdana, arial, sans-serif; background-color: transparent; font-style: normal;"><span style="font-family: tahoma, verdana, arial, sans-serif; font-size: 12px;">Will investigate. </span></div><div style="color: rgb(0, 0, 0); font-size: 12px; font-family: tahoma, verdana, arial, sans-serif; background-color:
 transparent; font-style: normal;"><span style="font-family: tahoma, verdana, arial, sans-serif; font-size: 12px;">thanks</span></div><div style="color: rgb(0, 0, 0); font-size: 12px; font-family: tahoma, verdana, arial, sans-serif; background-color: transparent; font-style: normal;"><span style="font-family: tahoma, verdana, arial, sans-serif; font-size: 12px;">Hs</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div><br></div>  <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Dave Angel <davea@davea.name><br> <b><span style="font-weight: bold;">To:</span></b> tutor@python.org
 <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, February 5, 2013 5:20 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Tutor] Getting range of a list<br> </font> </div> <br>
On 02/05/2013 04:48 PM, Hs Hs wrote:<br>> Thanks Steve.<br>><br>> But one question, when I print, I get extra empty lines. How to get rid of them!  Thanks again.<br>>>>> f = open('test')<br>>>>> head = '---'<br>>>>> for line in f:<br><br>line = line.rstrip()     #get rid of the trailing newline (and any other <br>whitespace there)<br><br>> if line.startswith('>'):<br>> head = line[1:].strip()<br>> else:<br>> print head+'\t'+line<br><br>The print generates a newline by default.  So you either have to do the <br>strip() I suggested above, or use a trailing comma on the print.  I <br>recommend the former.<br><br>><br>> X1A<br>>                          <------<br>> X1G<br>>                         <-----<br>>
 X2A<br>><br>> X2G<br>><br>> X3A<br>><br>> X3G<br>><br>> X4A<br>><br>> X4A<br>><br>> Thanks<br>> Hs.<br>><br>><br>><br><br>You're still posting using html mail.  And your indentation is still <br>getting messed up.  Also, you top-posted.<br><br><br>-- <br>DaveA<br>_______________________________________________<br>Tutor maillist  -  <a ymailto="mailto:Tutor@python.org" href="mailto:Tutor@python.org">Tutor@python.org</a><br>To unsubscribe or change subscription options:<br>http://mail.python.org/mailman/listinfo/tutor<br><br><br> </div> </div>  </div></body></html>