Python Forum
csv files - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: csv files (/thread-34681.html)



csv files - faustineaiden - Aug-20-2021

I'm new to python. When reading and writing csv files, I want to achieve that the values corresponding to the dialogue column and the values corresponding to utterance are spliced into dia{}_utt{}. Please see the attachement. How to do that? Could you please show some coding or tutorial for me?

[Image: image.png]


RE: csv files - Yoriz - Aug-20-2021

dialogue = 0
utterance_id = 1
path_file = f"dia{dialogue}_utt{utterance_id}.csv"
print(path_file)
Output:
dia0_utt1.csv