python中,如有个非常长的字符串,在写的时候如何将其分隔

说明

  比如,有个长字符串,Put several strings within parentheses to have them joined together.但是我在写脚本的时候,

  想要放在多行来写,如何进行切割

操作过程

1.通过多个字符串的拼接,并且放入到括号中

>>> text = ('Put several strings within parentheses'                           
            "to have them joined"
            'together.')
            
>>> text
'Put several strings within parenthesesto have them joinedtogether.'

#注意:一定把所有字符串放入到括号中

>>> text = ('put' +
            'ABc')
            
>>> text
'putABc'

备注:将多个字符串放入到括号中,然后还是使用之前的字符串拼接方式完成拼接。

 

文档创建时间:2018年11月23日11:16:15

posted @ 2018-11-23 11:17  Zhai_David  阅读(4831)  评论(1编辑  收藏  举报