My intention for the code bellow is to save a file inside a folder. But the file is beeing saved on the folder before the correct one.
How can i modify it so it saves the file to correct folder?
#Make Selenium check the chatroom name
chatroom = driver.find_element_by_class_name('_19vo_').text
#Create a variable of a folder path with chatroom name
chat_path = 'D:\Drive\Outros\Python\data_save\chats\ ' + chatroom
#Verify if folder already exists, if not, create it
Path(chat_path).mkdir(parents=True, exist_ok=True)
#Save a df.csv to the chatroom folder
df.to_csv(chat_path +chatroom+' in'+ timestr +' .csv', index=None, header=True, encoding='utf-8-sig')