I am trying to write a function that would generate a word file using multiple variables but I'm having a bit of trouble actually pushing the variables into the word file.
def DocGenerator (var1, var2, var3...var20) :
doc = DocxTemplate("new_doc.docx")
doc.render({var1, var2, var3...var20})
print(f'Creating New Document for {var1}')
doc.save(f'Document for {var1}.docx')
When I comment out the doc.render line above, the print statement actually shows the variables and the document gets created from the doc.save line with the correct title. So I know the variables are being passed into the function and are working. But when the doc.render line is not commented I get the following error message:
jinja2.exceptions.TemplateSyntaxError: expected token 'end of print statement', got 'Ticket'
Can anyone tell me what I'm doing wrong?