gpt4 book ai didi

Python:在三引号中键入制表符和\t 之间的区别

转载 作者:太空狗 更新时间:2023-10-30 02:31:58 26 4
gpt4 key购买 nike

当用三重引号 """写一个字符串时,在字面上放入\n 或\t 换行或制表符,和在引号内​​按你想要的方式写它有什么区别?例如:

sample = """ I'm writing this 
On separate lines
And tabs
So why can't I write it like this
/t instead of tabbing like this
\n or new lining like this.
Is one way preferred over the other? """

是否首选一种方式?

最佳答案

请记住,明示比含蓄更好。使用特定的 \t\n 没有任何假设的余地。

关于Python:在三引号中键入制表符和\t 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21028316/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com