I need help with the following code:
def CreateFile(shortcut, name):
try:
shortcut = open(name, 'x')
except FileExistsError:
print('That file already exists. Open it with OpenFile(shortcut, name).')
else:
print('File created. Open the file using OpenFile(shortcut, name).')
When I execute it, I get the following error:
IndentationError: unindent does not match any outer indentation level
This error code is pointing out the semicolon after [except FileExistsError:]
Can I please get a solution? This is how I saw other people's code and would like advice. I am creating my own operating system, in which OpenFile(shortcut, name) exists.