My style

数据类型:字符串补充

#输出对应索引和字符

test=input('>>>')
for item in range(0,len(test)):
    print(item,test[item])

#随机四位验证码

def check_code():
    import random
    checkcode=''
    for i in range(4):
        current=random.randrange(0,4)
        if current !=i:
            temp = chr(random.randint(65, 90))
        else:
            temp=random.randint(0,9)
        checkcode+=str(temp)
    return  checkcode
code=check_code()
print(code)

#可迭代对象:可以被for进行循环获取

#类,类型
str 各种方法
#对象,根据str类型创建的一个对象:s1
s1='alex'
s2='18'
int
...
a=123
#连接
   v='_'.join(['alex','eric'])
print(v)
 
posted @ 2020-08-13 16:06  pkfaces  阅读(84)  评论(0)    收藏  举报