talkWithME / aa.py
hyo37009's picture
.
34c2cc1
raw
history blame contribute delete
464 Bytes
docs = open("sample.pdf", "r")
doc_list = []
for file in docs:
print('file - type : ', file.type)
if file.type == 'text/plain':
# file is .txt
print("txt")
elif file.type in ['application/octet-stream', 'application/pdf']:
# file is .pdf
print("pdf")
elif file.type == 'text/csv':
# file is .csv
print("csv")
elif file.type == 'application/json':
# file is .json
print("json")