zoukankan      html  css  js  c++  java
  • python 字符串

    1. join(self, ab=None, pq=None, rs=None): # real signature unknown; restored from __doc__

        """
    Concatenate any number of strings.

    The string whose method is called is inserted in between each given string.
    The result is returned as a new string.

    Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
    a = "你不是美女!"
    print(a)
    b = "***"
    c = b.join(a)
    print(c)
    
    ——————-
    你不是美女!
    你***不***是***美***女***!
    

    2. split(self, *args, **kwargs): # real signature unknown

    a = 'jfwiefuieowir'
    b = a.split('i',2)
    print(b)
    __________
    ['jfw', 'efu', 'eowir']
    

      

    a = 'jfwiefuieowir'
    b = a.split('i')
    print(b)
    ______________
    ['jfw', 'efu', 'eow', 'r']
    

    3. find(self, sub, start=None, end=None): # real signature unknown; restored from __doc__

        """
    S.find(sub[, start[, end]]) -> int

    Return the lowest index in S where substring sub is found,
    such that sub is contained within S[start:end]. Optional
    arguments start and end are interpreted as in slice notation.

    Return -1 on failure.
    """
    return 0
    a = 'jfwiefuieowir'
    b = a.find('u',2,10)
    print(b)
    _________
    
    6
    

     4.  strip(self, *args, **kwargs): # real signature unknown

        """
    Return a copy of the string with leading and trailing whitespace remove.

    If chars is given and not None, remove characters in chars instead.
    """
    pass
    a = '    jfwiefuieowir      '
    b = a.strip() #删除前面和后面的空格
    c = a.lstrip() #删除左面的空格
    d = a.rstrip() #删除右面的空格
    print(a,'
    ',b,'
    ',c,'
    ',d)
    
    ________________________
    
        jfwiefuieowir       
     jfwiefuieowir 
     jfwiefuieowir       
         jfwiefuieowir
    

    5. lower(self, *args, **kwargs): # real signature unknown

        """ Return a copy of the string converted to lowercase. """
    pass
     upper(self, *args, **kwargs): # real signature unknown
    """ Return a copy of the string converted to uppercase. """
    pass
    a = 'TjkdFGklfsaYYY'
    b = a.lower()
    c = a.upper()
    print(a,'
    ',b,'
    ',c,'
    ')
    ___________________
    
    TjkdFGklfsaYYY 
     tjkdfgklfsayyy 
     TJKDFGKLFSAYYY 
    

      




     
  • 相关阅读:
    结对第二次作业——某次疫情统计可视化的实现
    结对作业(1)--疫情统计可视化(原型设计)
    软工实践寒假作业(2/2)
    软工实践寒假作业(1/2)
    Prometheus监控docker容器(三)
    Prometheus数据持久化存储(二)
    HTTPS SSL证书在线生成
    从零搭建Prometheus监控报警系统(一)
    Ubuntu 16.04 误删内核后的系统恢复
    通过URL触发Jenkins构建
  • 原文地址:https://www.cnblogs.com/jijianhu/p/10306598.html
Copyright © 2011-2022 走看看