• 字符串操作练习:星座、凯撒密码、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')

  • 相关阅读:
    datagridview 批量更新、日期设置、指定列弹出右键菜单
    CAD ObjectARX扩展工具的源码(二)
    ObjextARX-VS2005-字符串转换
    二叉搜索树(二叉查找树)
    贪婪算法-货物装载问题
    Messagebox.Show()常用参数的讨论
    关于矩形排样问题(三)
    单纯形法实现一维管材排料最优化
    [转载]共享一些常用的代码
    转载]取硬盘ID的API实现
  • 原文地址:https://www.cnblogs.com/lqy-36/p/7543400.html
Copyright © 2020-2023  润新知