我如何写一个“标签"?在 Python 中? [英] How do I write a "tab" in Python?
本文介绍了我如何写一个“标签"?在 Python 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有一个文件.你好"TABalex"怎么写?
Let's say I have a file. How do I write "hello" TAB "alex"?
推荐答案
这是代码:
f = open(filename, 'w')
f.write("hello\talex")
字符串中的\t
是水平制表的转义序列.
The \t
inside the string is the escape sequence for the horizontal tabulation.
这篇关于我如何写一个“标签"?在 Python 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文