I couldn't figure out how to perform line.startswith("substring") for a set of substrings, so I tried a few variations on the code at bottom: since I have the luxury of known 4-character beginning substrings, but I'm pretty sure I've got the syntax wrong, since this doesn't reject any lines.
(Context: my aim is to throw out header lines when reading in a file. Header lines start with a limited set of strings, but I can't just check for the substring anywhere, because a valid content line may include a keyword later in the string.)
cleanLines = []
line = "sample input here"
if not line[0:3] in ["node", "path", "Path"]: #skip standard headers
cleanLines.append(line)
line[0:4]or simplyline[:4].startswith()calls the "beginning substrings" prefixes.