Update 2.CV_Uploader.py

parent c0684ebe
#Text to String (utf-8)
import re
import os
from chardet import detect
import docx2txt import docx2txt
#Upload Resume
CV = docx2txt.process("se resume.docx")
CV = docx2txt.process("C:/Users/User/Desktop/New folder (12)/Applicant_Ranker - Copy/UploadedCV/Mahela.docx")
with open("Resume.txt", "w") as text_file: with open("Resume.txt", "w") as text_file:
print(CV, file=text_file) print(CV, file=text_file)
\ No newline at end of file
# get file encoding type
def get_encoding_type(file):
with open(file, 'rb') as f:
rawdata = f.read()
return detect(rawdata)['encoding']
from_codec = get_encoding_type('Resume.txt')
#Resume convertion
try:
with open('Resume.txt', 'r', encoding=from_codec) as f, open('ResumeStr.txt', 'w', encoding='utf-8') as e:
text = f.read() # for small files, for big use chunks
e.write(text)
except UnicodeDecodeError:
print('Decode Error')
except UnicodeEncodeError:
print('Encode Error')
f = open("ResumeStr.txt", "r")
content = f.read()
def check(string):
regex = re.compile("twitter.+\w*")
match_object = regex.findall(string)
if len(match_object) != 0:
for word in match_object:
return word
else:
print("No Twitter Details")
Twitter_link = str(check(content))
Twitter_ID = Twitter_link[Twitter_link.find("/")+1:]
with open('TwitterID.txt', 'w') as the_file:
the_file.write(Twitter_ID)
#print(Twitter_ID)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment