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')
     

  • 相关阅读:
    bootstrap插件学习-bootstrap.tooltip.js
    1,2,3维数组去重方法
    使用PHP静态变量当缓存的方法
    深思 PHP 数组遍历的差异(array_diff 的实现)
    ecshop学习五
    ecshop学习四
    ecshop学习三
    ecshop学习二
    ecshop学习一
    linux下安装ecshop
  • 原文地址:https://www.cnblogs.com/guo2016/p/7542285.html
Copyright © 2011-2022 走看看