在python中,三引号支持字符串跨多行、包含换行符号、制表符号、以及其它特殊字符

>>> hi = '''
... this 
... is a 
... test
... '''
>>> print hi

this 
is a 
test

>>> hi
'\nthis \nis a \ntest\n'
>>> 

 

此外,还可以进行多行注释。

相关文章:

  • 2021-11-27
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2021-09-16
  • 2021-10-28
  • 2022-12-23
  • 2021-12-29
猜你喜欢
  • 2022-12-23
  • 2021-04-02
  • 2021-11-23
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
相关资源
相似解决方案