Home > Back-end >  Pandas filepath includes a single quote
Pandas filepath includes a single quote

Time:03-09

I'm trying to read an excel file from a directory path that includes a single quote and it's causing me problems. Any ideas on how to get around it. Say the filepath is c:\users\me\excel\actual's\test.xlsx. I can't change the path name and remove the quote, I need to be able to work around the single quote

import pandas as pd
import os
download_dir = r'c:users/me/excel/actual's'
os.chdir(download_dir)
lst = os.listdir

CodePudding user response:

Are you able to use " instead?

download_dir = r"c:users/me/excel/actual's"
  • Related