Check if file exists on excel table using Python

I have a csv table full of file’s path. I want to check for each row if file exists.

import csv
import os.path
import ntpath
import shutil

with open('C:Test.csv', newline='') as csvfile:
    spamreader = csv.reader(csvfile)
    for row in spamreader:
        print(', '.join(row))
        if os.path.exists(str(row)):

Table’s row example: c:testnotfound.xlsx

I don’t understand why my code is not working? When I set row with a fix path it’s working just fine! row = “c:/test/notfound.xlsx”

Source: python

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.