Created
June 7, 2022 07:00
-
-
Save Lakshmi-1212/4215732b462aacb70adec1fe4264c456 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def read_file(filepath, use_method = 'textract'): | |
text = "" | |
if not os.path.isfile(filepath): | |
print(f'Invalid file:{filepath}') | |
else: | |
if use_method == 'textract': | |
return read_file_textract(filepath) | |
elif use_method == 'pypdf': | |
return read_file_pypdf(filepath) | |
else: | |
print('Invalid method to read file. Supported formats: "textract" or "pypdf".') | |
return text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment