In Python: how can I say:
line = line.partition('#' or 'tab')[0] ... do something with
I know that I can:
line = line.partition('#')[0] ... do something
But what is the code for the tab character, and can I say # or tab?
Update: I am trying to read the first word on each line if you read #, and then ignore everything after this character (since this is a comment). But then I found that if I had # in the first tab of the word, then it will read the tab as part of the first word. So I tried to say if you read a tab or hash and then treat the line as a comment. The work around is simply to put a space after the first word, and not on the tab. But it is not very elegant. Now I understand that the if statement was wrong, I tried to simplify the situation too much. The above is already true, but I think the path of Ned Batchelder is the path, but maybe now there is something else that you know what I'm trying to do.