Skip to content

Instantly share code, notes, and snippets.

@oliver-batey
Last active January 19, 2021 09:42
Show Gist options
  • Save oliver-batey/3818dbd131afce7bb4bc529e212c4802 to your computer and use it in GitHub Desktop.
Save oliver-batey/3818dbd131afce7bb4bc529e212c4802 to your computer and use it in GitHub Desktop.
Example bad file parsing function
def serialise_file(document,format):
if format =='txt':
with open(document, 'r') as file:
string = file.read().replace('\n', ' ')
return string
elif format == 'docx'
#docx parsing code here
elif format == 'pdf':
#pdf parsing code here
else:
raise ValueError(format)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment