content = os.path.abspath("content")
for i in os.listdir(os.path.abspath("content")):
path = str(i)
bot.upload_photo(content "/" path, caption ="Technical Scripter Event 2019")
SO, I need to make something like this.The program makes the files from the folder variables and I need to connect the path to it.
1 Answer 1
This line contains a syntax error:
bot.upload_photo(content "/" path, caption ="Technical Scripter Event 2019")
In order to concatenate content and path, you should use os.path.join:
bot.upload_photo(os.path.join(content,path), caption ="Technical Scripter Event 2019")
Sign up to request clarification or add additional context in comments.
Comments
lang-py
content "/" path->content + "/" + path->os.path.join(content, path)str(i), becauseiis already a string object.