zoukankan      html  css  js  c++  java
  • python3----splitlines

    Python中的splitlines用来分割行。当传入的参数为True时,表示保留换行符 。通过下面的例子就很明白了:

     1 mulLine = """Hello!!!
     2  Wellcome to Python's world!
     3     There are a lot of interesting things!
     4         Enjoy yourself. Thank you!"""
     5 
     6 print(''.join(mulLine.splitlines()))
     7 print('------------')
     8 print(''.join(mulLine.splitlines(True)))
     9 
    10 results:
    11 
    12 Hello!!! Wellcome to Python's world!    There are a lot of interesting things!        Enjoy yourself. Thank you!
    13 ------------
    14 Hello!!!
    15  Wellcome to Python's world!
    16     There are a lot of interesting things!
    17         Enjoy yourself. Thank you!
  • 相关阅读:
    RabbitMq
    SAAS-HEM
    java框架
    数据结构
    JVM
    springboot高级
    面试题汇总
    vue
    bootforum
    SpringBoot
  • 原文地址:https://www.cnblogs.com/jonm/p/8270284.html
Copyright © 2011-2022 走看看