You can concatenate the two strings using the +
operator and then write the resulting string to a file with a tab separator between them using the write()
method. Here's an example code block:
main.py116 chars6 lines
This code will create (or overwrite if it already exists) a file named "output.txt" in the current directory, and write the concatenated string "Hello\tWorld" to it, with a tab character as the separator.
gistlibby LogSnag