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