The easiest way to create or remove file is using python os module
To create file
import os
os.mknod("this_is_file.txt")
To create folder
os.mkdir("this is a folder")
To remove file
os.remove("this_is_file.txt")
To remove folder
os.rmdir("this is a folder")
The consideration.
If file already exist when creating file it will show error
so we can check if the file already exist
import os
if not os.path.exists("this_is_file.txt"):
os.mknod("this_is_file.txt")
or when deleting folder
import os
if os.path.exists("this is a folder"):
os.rmdir("this is a folder")