I have written the following code on Python on Linux OS:
variable='jack'
import os
os.system('mkdir '+variable)
Then a directory is made with the name jack on the present working directory.
However, if I want to use file handling for the same purpose
variable='jack'
f=open('xyz.txt', mode="w")
f.write("import os")
f.write("os.system('mkdir '+variable)")
f.close()
then the code os.system('mkdir '+variable) is appended as it is in the xyz.txt file instead of os.system('mkdir jack')
Please help me to get this variable inside the file xyz.txt!