This does indeed not work. The simplest way is print(TO_CSV,...) with a format string and all variables that you want to export.