• 变量


    变量
    当你不知到内容是什么的时候
    当一串内容很长时
    当发生重用的时候
    #: bool , str . dict. list.set, int   一些形式
    # strip,rstrip,lstrip  
    # s = '   hello  '  
    # print(s)
    # re = s.strip()
    # re2 = re.lstrip('h')     #:strip能去除多余的空格
    #:print(r2)       #:lstrip能去除字符串的开头和结尾的字母但不能去中间
                 
    # startswith,endswith
    # s = '   hello  '
    # re = s.strip()
    # print(re.startswith('h')) #:startswi方法用于检查字符串是否是以指定子字符串开头,如果是则返回 True,否则返回 False
    # print(s.endswith(' '))  #: endswith() 方法用于判断字符串是否以指定后缀结尾,如果以指定后缀结尾返回True,否则返回False
    #:replace
    # s = 'hello alex,age is 18,myname is alex'
    # re = s.replace('alex','egon')     #:replace 具有取代的功能 
    # re = s.replace('alex','egon',1)   #:后面的数字的用途就是当一时改一个名字当数字是几位就改几个
    # print(re)
     
    #name = input('your name :')
    # print(name)    #:%s的作用就是格式化字符串吧name变量的内容替换到%s处打印
    #print('hello %s,age is %s'%(name,18))
    #print('hello {},age is {}'.format(name,18))  
    #print('hello {0},age is {1}'.format(name,18))
    #print('hello {name},age is {name}'.format(name=name,age=18))
     
    # split
    #:s = 'hello alex,age is 18,myname is alex'
    #:l = s.split() #=s.split(' ')
    #print(type(l))       #:把字符串变成列表的形式
    #:print(l)
    # l2 = s.split(',')     
    # print(type(l2))   #:查看其属性
    # print(l2)    
    #:t = tuple(l)    #:把列表的形式转化字符串
    #:s2 = ' '.join(t)
  • 相关阅读:
    多线程伪共享FalseSharing
    C语言restrict限定符
    Linux线程基础函数
    Linux信号函数
    C函数前向声明省略参数
    12.2 关闭DLM 自动收集统计信息 (SCM0)ORA-00600之[ksliwat: bad wait time]
    pdb的数量限制
    关闭或开启memory_target
    OSWATCH安装
    参数SID写错,ERROR OGG-00664 ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist
  • 原文地址:https://www.cnblogs.com/nupecs/p/6773785.html
Copyright © 2020-2023  润新知