from pathlib import Path
paths =('1.txt','2.txt')
for path in paths :
p = Path(path)
if p.exists() :
print(path+' exists')
import os
paths =['javaconvertor.py','test.py','folder name']
for path in paths :
if os.path.exists(path)==True :
#do code here