Python strip with \n [duplicate]
You should be able to use line.strip(‘\n’) and line.strip(‘\t’). But these don’t modify the line variable…they just return the string with the \n and \t stripped. So you’ll have to do something like line = line.strip(‘\n’) line = line.strip(‘\t’) That should work for removing from the start and end. If you have \n and \t … Read more