Is there any other way to write into a file using more than one arguments?
type error: write() takes exactly one argument (3 given)
f.write("=" * 40 + str("System Information") + str("=" * 40)) even this is working for my requirement
Use the file
parameter of print
and give it a valid file handle. This way you can use an arbitraty amount of arguments.
print(..., ..., ..., file=f)
Note that you can adjust the sep
parameter of the print function as required if you don't want to have your strings whitespace-separated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.