Tudor Nicolescu
Tudor Nicolescu

Reputation: 39

How to make a path from variables

 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.

Upvotes: 0

Views: 34

Answers (1)

kn0wmad1c
kn0wmad1c

Reputation: 110

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")

Upvotes: 2

Related Questions