Let\'s say I\'m parsing a file, which uses ; as the comment character. I don\'t want to parse comments. So if I a line looks like this:
;
example.com.
For Python 2.5 or greater, I would use the partition method:
rtr = line.partition(';')[0].rstrip() + '\n'