-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextExtractor.py
More file actions
25 lines (24 loc) · 777 Bytes
/
textExtractor.py
File metadata and controls
25 lines (24 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#
# This module can extract text from a .txt file
#
def textExtract(location):
try:
file = open(location, "r")
try:
text = file.read()
try:
file.close()
try:
return text
except:
print(
"Error while returning result! [Error issued from textExtractor module]")
except:
print(
"Error while closing file! [Error issued from textExtractor module]")
except:
print(
"File could not be read! [Error issued from textExtractor module]")
except:
print(
"File could not be opened! [Error issued from textExtractor module]")