• 字符串操作练习:星座、凯撒密码、99乘法表、词频统计预处理


    for i in range(12):
        print(chr(9800+i),end="/")

    sr1="abcdefghijklmnopqrstuvwxyz"
    sr2=sr1.upper()
    sr=sr1+sr1+sr2+sr2
    st=input("please input:")
    sR=""
    for j in st:
        if j==" ":
            sR = sR +" "
            continue
        i=sr.find(j)
        if(i>-1):
            sR=sR+sr[i-3]
    print(sR)

    a=input("please input:")
    print("{0: ^4}".format(a))

    a=float(input("输入生产总值"))
    b=input("输入年份")
    print("{1}年的生产总值是:{0:,.2f}亿元".format(a,b))

    for x in range(1,10):
        for y in range(1,x+1):
            print("{}*{}={}".format(x,y,x*y),end=" ")
        print("
    ")

    w='''I need you boo and I see you boo
    And the heart's all over the world tonight
    Said the heart's all over the world tonight
    Hey, little mama, ooh you're a winner
    Hey, little mama, yes you're a winner
    I'm so glad to be yours
    You're a class all your own and
    Ooh, little cutie, when you talk to me
    I swear the whole world stops
    You're my sweetheart
    I'm so glad that you're mine
    You are one of a kind and
    You mean to me
    What I mean to you and
    Together baby
    There is nothing we won't do
    'Cause if I got you
    I don't need money
    I don't need cars
    Girl, you're my all
    And oh, I'm into you
    Girl, no one else would do
    'Cause with every kiss and every hug
    You make me fall in love
    And now I know I can't be the only one
    I bet there's hearts all over'''
    print("need出现的次数",w.count('need'))
    for i in w:
        w=w.replace(","," ")
        w=w.replace("?"," ")
        w=w.replace("!"," ")
        for i in w:
            w=w.lower()
    print(w)

    import webbrowser
    a=input("输入想要打开的页数:")
    webbrowser.open_new_tab('http://news.gzcc.cn/html/xiaoyuanxinwen/'+str(a)+'.html')

  • 相关阅读:
    Spring注解(环境)
    Spring注解(赋值相关)
    C#:关联程序和文件
    C#: 获取执行程序所在路径和启动资源管理器
    C#:WPF绘制问题
    WPF:窗体置顶
    C#:屏幕显示区域问题
    C#:文件、文件夹特别操作
    C#:插件、框架
    WPF:MenuItem样式
  • 原文地址:https://www.cnblogs.com/lqy-36/p/7543400.html
Copyright © 2020-2023  润新知