I am trying to replace part of url by gene id using python 3.5. Can someone help me in replacing 'xxx' by integer stored in variable input_id?
input_id = 135
my_url = "https://www.ncbi.nlm.nih.gov/gene/xxx"
I am trying to replace part of url by gene id using python 3.5. Can someone help me in replacing 'xxx' by integer stored in variable input_id?
input_id = 135
my_url = "https://www.ncbi.nlm.nih.gov/gene/xxx"
Try this code.
my_url = "https://www.ncbi.nlm.nih.gov/gene/xxx"
input_id = 135
print my_url.replace("xxx",str(input_id))
o/p: https://www.ncbi.nlm.nih.gov/gene/135