How to put an input into a url in Python


I have an input function

id = input("Enter your ID here: ")

and I wish to add this ‘id’ input into the URL address below accordingly. Is there an easy way for me to go about this?

manager_history_url = (

I input the above and it returns a JSON decode error.

Asked By: ILE2091



You could use an f-string:

manager_history_url = f'{id}/history/'
Answered By: Mureinik
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.