1

I want a put a random line from a file using jinja template.

for ex: I have a list of names (1000+) stored in a file. I want to pick a random name from that file and put it in template.

something like below:

Name={{ import_file_as_list("name_samples.txt") | random }}

Is it possible? How can we achieve so using jinja without changing the rendering logic?

Note: I can not modified the rendering logic (python file), as I am using a rest api to render.

Jay Joshi
  • 1,402
  • 1
  • 13
  • 32

0 Answers0