1. 使用制表符转义序列 `\t`:
print("Hello\tworld!")
2. 使用Unicode制表符字符 `u0009`:
print("u0009Hello\tworld!")
3. 使用 `format()` 方法:

name = "John"age = 30print("{}\t{}".format(name, age))
4. 使用 `tabulate` 模块:
from tabulate import tabulatedata = [["Name", "Age"], ["John", 30], ["Jane", 25]]print(tabulate(data, tablefmt="grid"))
5. 使用 `join()` 方法结合列表中的元素:
data = [["姓名", "年龄", "性别"], ["小明", "18", "男"], ["小红", "20", "女"], ["小李", "22", "男"]]print("\t".join(data)) 输出表头for row in data[1:]:print("\t".join(row)) 输出数据行
以上方法都可以用来在Python中输出制表符,具体使用哪种方法取决于你的需求和代码的上下文
