How do I write a "tab" in Python? Ask Question

How do I write a

Let's say I have a file. How do I write "hello" TAB "alex"?

ベストアンサー1

This is the code:

f = open(filename, 'w')
f.write("hello\talex")

The \t inside the string is the escape sequence for the horizontal tabulation.

おすすめ記事