I have a Python code which detects my files. Now I will open it in Latex. But it seems not possible to give the detected names to Latex I have tried this:
\begin{pycode}
l = [f for f in os.listdir('path') if f.endswith('.jpg')]
\end{pycode}
\includegraphics[scale=0.1]{\py{l}}
Because it did not work I have used this:
\newcommand{\filename}{}
\edef\filename{l}
\includegraphics[scale=0.75]{\filename}
I need this because I have different files. They have filename that looks like this: part1_date, part1 is always the same only the date is variable. Therefore the day should be refered in the text (for example like the reference to a equation. And of course it must be printed.
Is it possble to do this with Pythontex? Or can I do this with another method?
Thanks

PythonTeXbut filenames with_characters are problematic, since_is interpreted as a math mode command starting subscripts. – Apr 24 '14 at 06:27