zoukankan      html  css  js  c++  java
  • 字符串操作等

    中文变编码:

    s='我是中国人,广州商学院'
    for i in s:
         print(ord(i))

    显示12星座:

    print('12星座编码输出符号:')
    for i in range(12):
        print(chr(9800+i),end='	')

    九九乘法表:

    for i in range(1,10):
        for j in range(1,i+1):
            print('{}*{}={:2}'.format(j,i,i*j),end=' ')
        print(' ')
            

    字符串对齐:

    s1=input('输入姓名1:')
    s2=input('输入姓名2:')
    s3=input('输入姓名3:')
    print('字符串是:{0:*>8}{1:*>8}{2:*>8}'.format(s1,s2,s3))

    凯撒密码:

    s=input('输入一个明文字符串:')
    print('输出明文:',end=' ')
    for i in s:
        if ord('a')<=ord(i)<=ord('z'):
            print(chr(ord('a')+(ord(i)-ord('a')+3)%26),end=' ')
        else:
            print(i,end= ' ')

    歌词替换标点符号:

    ge='''You're insecure
    Don't know what for
    you're turning heads When you walk through the door
    You don't know Oh oh!
    You don't know you're beautiful Oh oh?
    That's what makes you beautiful.
    
    '''
    print(ge.count('you'))
    for i in ge:
        ge1=ge.replace('!','/')
        ge2=ge1.replace('?','/')
        ge3=ge2.replace('.','/')
    print(ge3.lower())

    打开网页。

    import webbrowser as web
    for  i in range(2,5):
        web.open_new_tab('http://news.gzcc.cn/html/xiaoyuanxinwen/'+str(i)+'.html')
     

  • 相关阅读:
    linux7系统进入单用户模式
    GoAccess日志分析工具
    yum总结
    分布式文件系统---GlusterFS
    【centos7】添加开机启动服务/脚本
    centos 7 服务初始化
    chrony软件
    [USACO4.1]麦香牛块Beef McNuggets 题解报告
    组合数的几种计算方法
    【ZJOI2005】沼泽鳄鱼 题解报告
  • 原文地址:https://www.cnblogs.com/guo2016/p/7542285.html
Copyright © 2011-2022 走看看