I am working on writing a simple python application for linux (maemo). However I am getting SyntaxError: invalid syntax on line 23: with open(file,\'w\') as f
SyntaxError: invalid syntax
with open(file,\'w\') as f
Most likely, you are using an earlier version of Python that doesn't support the with statement. Here's how to do the same thing without using with:
with
fileh = open(file, 'w') try: # Do things with fileh here finally: fileh.close()