美文网首页Python四期爬虫作业
【Python爬虫】- 8.12练习题

【Python爬虫】- 8.12练习题

作者: feliz_boy | 来源:发表于2017-08-12 13:38 被阅读0次
    a = 'I'
    b = 'like'
    c = 'python'
    print("'", a, b, c, "'")
    

    result:

    ' I like python '
    
    s = ' sdghHhf '
    s1 = s.strip()
    print(s1)
    s2 = s1.upper()
    s3 = s1.lower()
    print(s2, s3)
    s4 = s1.find('h')
    print(s4)
    

    result:

    sdghHhf
    SDGHHHF sdghhhf
    3
    
    x = 'I {} python'
    x1 = x.format('like')
    x2 = x.replace('{}', 'like')
    print(x1)
    print(x2)
    

    result:

    I like python
    I like python
    
    capital = '人民币100万元'
    print(len(capital))
    print(capital.isdigit())
    

    result:

    8
    False
    

    相关文章

      网友评论

        本文标题:【Python爬虫】- 8.12练习题

        本文链接:https://www.haomeiwen.com/subject/pxwrrxtx.html