How to rename a text file using an integer variable in Python? : <p>I want to rename a file xyz.txt to 1.txt. Consider 1 as an integer variable in 1.txt.</p>

<p>I have tried os.rename(old name, new name). But in the new name, I want to pass my integer variable + ".txt"</p>
