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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM