Reputation: 557
I am trying to pass some variables into my string. However when I run this, i literally get userid
and monthyear
code:
url = (r"C:\Users\{userid}\Report - {monthyear}.xlsx")
Returns:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\{userid}\\Report - {monthyear}.xlsx'
Upvotes: 0
Views: 54
Reputation: 260
you forgot the f for formatting
url = (rf"C:\Users\{userid}\Report - {monthyear}.xlsx")
Upvotes: 2