this is the content to write in a tex file:
content=r'''\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs} % for much better looking tables
\usepackage{multirow}
\usepackage{caption}
\captionsetup{labelformat=empty}
\begin{document}
\begin{table}[htbp]\caption{Common Prediction}
\centering
\input{common%(index)s}
\end{table}
\end{document}
'''
i want to replace 'index' with a integger value. When i write:
with open(directoryPath + os.sep +'commonTables3.tex','w') as f:
f.write(content%({'index':str(3)}))
i have the follow error:
f.write(content%({'index':str(3)}))
TypeError: a float is required
i don't understand where is my mistake. I try to change '%(index)s' in '%(index)d' (and 'index':str(3) in 'index':3) but i still have the same error. thanks