comparison abcfirstline.py @ 54:00a1bef43a34

Fix past end of string bug in Python first line hack.
author Jim Hague <jim.hague@laicatc.com>
date Sun, 04 Mar 2012 21:44:31 +0000
parents e666306c5ab1
children 811151d3ae73
comparison
equal deleted inserted replaced
53:c47bd41e9840 54:00a1bef43a34
9 def process(inf): 9 def process(inf):
10 print "X:1" 10 print "X:1"
11 for line in inf: 11 for line in inf:
12 line = line.strip() 12 line = line.strip()
13 start = line[:2] 13 start = line[:2]
14 if start[0] != "|" and start[1] == ":": 14 if len(start) > 1 and start[0] != "|" and start[1] == ":":
15 if start[0] in ["M", "K", "L"]: 15 if start[0] in ["M", "K", "L"]:
16 print line 16 print line
17 elif start[0] != "%": 17 elif start[0] != "%":
18 print line 18 print line
19 if line[-1] != "\\": 19 if line[-1] != "\\":