Insert a parameter to path

How should I insert a parameter to the path, eg.:

path = ["default]mytag_*param1*/role"]
values = ["User"]

I tried:
path = ["default]mytag_"+*param1*+"/role"]
it does not work.

something like this should work if I understand what you are trying to do:

path = ["[default]mytag_{}/role".format(param1)]
values = ["User"]

This is assuming that your script has a variable called param1.
The format function will fill in the spot of the {} with whatever the value of param1 is.
here is an example of usage of the format function with several parameters that I executed in a python shell:

>>> param1 = 'is'
>>> param2 = 'an'
>>> param3 = 150
>>> 'here {} {} example. #{}'.format(param1, param2, param3)
'here is an example. #150'

*edit note:
You have a typo in your tag path. You forgot the opening square bracket in the tag provider name. I fixed it in the code snippet that I provided above.

1 Like

Perfect, that works.

Thank you.

1 Like