当用三重引号 """写一个字符串时,在字面上放入\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/