I’m trying to do something like this with a boolean:
/* ... other stuff */
loggedDocument = false
for line in inFile:
if (line.find( /*something*/ ) != -1):
println("FOUND DOCUMENT: %s" % line)
loggedDocument = true
if (loggedDocument == false):
/* do something else */
But I keep getting invalid syntax errors. I googled but couldn’t find a simple boolean example, any ideas?
You’re looking for
TrueandFalse(note the capitals). Also the more pythonic way to write the last line isif not loggedDocumentinstead ofif loggedDocument == False. Edit: And BTW, theprintlnis not Python a builtin Python function; are you looking forprint()?