In Python: how do I say:
line = line.partition('#' or 'tab')[0] ... do something with
I know I can do:
line = line.partition('#')[0] ... do something
But what is the code for the tab character, and can I say # or tab?
Update: I'm trying to say read the first word on each line, if you read a # then ignore everything after that character (as it is a comment). But then I found if I had in the file first word tab #, then it would read the tab as part of the first word. So I was trying to say, if you read a tab or a hash, then treat the line as a comment. A work around is to just put a space after the first word rather than a tab. But it is not very elegant. I realize now that the if statement was incorrect, I was trying to simplify things too much. Above is now correct, but I think Ned Batchelder's way is the way to go now, but perhaps there is something else now that you know what I'm trying to do.