How do I pass variables in the command to be executed by subprocess?

for example, I now have a variable date="2018", and I want to use subprocess to execute the following linux command, such as touch date.txt, that is touch 2018.txt. How can this be implemented?

Mar.28,2021

the simple way is to use subprocess's call, such as

.
subprocess.call(["touch", date + ".txt"])

if you have more requirements for child processes, such as non-blocking calls. You can use the relatively complex subprocess.Popen

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39567-2c168.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39567-2c168.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?