file_name = input('Enter the file name: ')
try:
file_handler = open(file_name)
except:
print('File cannot be opened:', file_name)
quit()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter