Though files are in same directory I'm getting with open(file, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: 'breast_cancer.txt'
I've following code under pre_process_data.py:
import re
cancer_text = ['breast_cancer.txt', 'colorectal_cancer.txt', 'lung_cancer.txt', 'prostate_cancer.txt',
'skin_cancer.txt']
for file in cancer_text:
# print(file)
with open(file, 'r') as f:
text = f.read()
f.close()
with open(file, 'w') as f:
print('pre-processing the file {}'.format(file))
text = re.sub("[!@#$+%*:()'-]", ' ', text)
text = text.lower()
f.write(text)
f.close()
The files are in same directory so this should be working but I've no idea why this is happening