Wrote some code and this syntax error keeps on occuring but I can't solve it. Due to wanting this only to print when verbose option is on I have included all code relating to the error line.
from __future__ import print_function
print = print_function
parser.add_argument("-v", "--verbose", action="store_true",help="Help option"
verboseprint = print if verbose else lambda *a, **k: None
if line2_rev:
verboseprint "Line2 has now been reversed"
verboseprint " Line2 has now been reversed"
^
SyntaxError: invalid syntax
I have attempted using ' ' instead as well as changing the string inside but same error occured. Any ideas?