Alan, Good point. Earlier I was trying to figure out how the script worked, and having else: print "break" seemed to help with that. For example, in one version that I was tinkering with, break was printed 17 times. In the current version, break is printed twice.
hope that makes sense, Grnat On 6/1/07, ALAN GAULD <[EMAIL PROTECTED]> wrote:
Grant, > My question is, is it possible to strip out multiple characters at once? Kent answered that bit. > started = False > for line in file('mylist.py'): > if 'jobs' in line and not started: > ... > if ']' not in line and started: > jobs.append(line.strip('...')) > else: print "break" Are you sure you only want to print break? If so the code will continue processing lines after the end of your list. My break command will exit the loop when it finds the ] character. If you don't want to use break you could set started to False again. Alan G. ------------------------------ New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships<http://uk.rd.yahoo.com/mail/uk/taglines/gmail_com/championships/games/*http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk/>. Plus: play games and win prizes.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor