标签:bre 字母 习题 lse 不可 创建 存在 划线 pac
# test = "username\temail\tpassword\nlaiying\tying@q.com\t123\nlaiying\tying@q.com\t123\nlaiying\tying@q.com\t123"
# v = test.expandtabs(20)
# print(v)
# test = "as2df"
# v = test.isalpha()
# print(v)
# test = "二" # 1,②
# v1 = test.isdecimal() #十进制
# v2 = test.isdigit() #可以识别特殊数字
# v3 = test.isnumeric() #可以包含汉字的数
# print(v1,v2,v3)
# \t 制表符
# \n 换行
# test = "oiuas\tdfkj"
# v = test.isprintable()
# print(v)
# test = ""
# v = test.isspace()
# print(v)
# test = "Return True if all cased characters in S are uppercase and there is"
# v1 = test.istitle()
# print(v1)
# v2 = test.title()
# print(v2)
# v3 = v2.istitle()
# print(v3)
# test = "你是风儿我是沙"
# print(test)
# # t = ‘ ‘
# v = "_".join(test)
# print(v)
# test = "Alex"
# v1 = test.islower()
# v2 = test.lower()
# print(v1, v2)
# v1 = test.isupper()
# v2 = test.upper()
# print(v1,v2)
# test = "xa"
# # v = test.lstrip(‘xa‘)
# v = test.rstrip(‘9lexxexa‘)
# # v = test.strip(‘xa‘)
# print(v)
# test.lstrip()
# test.rstrip()
# test.strip()
# 去除左右空白
# v = test.lstrip()
# v = test.rstrip()
# v = test.strip()
# print(v)
# print(test)
# 去除\t \n
# v = test.lstrip()
# v = test.rstrip()
# v = test.strip()
# print(v)
# test = "aeiou"
# test1 = "12345"
# v = "asidufkasd;fiuadkf;adfkjalsdjf"
# m = str.maketrans("aeiou", "12345")
# new_v = v.translate(m)
# print(new_v)
# test = "testasdsddfg"
# v = test.partition(‘s‘)
# print(v)
# v = test.rpartition(‘s‘)
# print(v)
# v = test.split(‘s‘,2)
# print(v)
# test.rsplit()
# test = "asdfadfasdf\nasdfasdf\nadfasdf"
# v = test.splitlines(False)
# print(v)
# test = "backend 1.1.1.1"
# v = test.startswith(‘a‘)
# print(v)
# test.endswith(‘a)
# test = "aLex"
# v = test.swapcase()
# print(v)
# a = "def"
# v = a.isidentifier()
# print(v)
# test = "alexalexalex"
# v = test.replace("ex",‘bbb‘)
# print(v)
# v = test.replace("ex",‘bbb‘,2)
# print(v)
# join # ‘_‘.join("asdfasdf")
# split
# find
# strip
# upper
# lower
# replace
###################### 4个灰魔法 ######################
# test = "郑建文妹子有种冲我来"
# for 变量名 in 字符串:
# 变量名
# break
# continue
# index = 0
# while index < len(test):
# v = test[index]
# print(v)
# index += 1
# print(‘=======‘)
# for zjw in test:
# print(zjw)
# test = "郑建文妹子有种冲我来"
# for item in test:
# print(item)
# break
# for item in test:
# continue
# print(item)
# v = test[3]
# print(v)
# v = test[0:-1] # 0=< <1 #-1表示最后一个位置
# print(v)
# Python3: len获取当前字符串中由几个字符组成
# v = len(test)
# print(v)
# 注意:
# len("asdf")
# for循环
# 索引
# 切片
# Python2中直接创建在内容中
# python3中只有for循环时,才一个一个创建
# r1 = range(10)
# r2 = range(1,10)
# r3 = range(1,10,2)
# 帮助创建连续的数字,通过设置步长来指定不连续
# v = range(0, 100, 5)
#
# for item in v:
# print(item)
##### 练习题:根据用户输入的值,输出每一个字符以及当前字符所在的索引位置 #####
# test = input(">>>")
# for item in test:
# print(item)
# 将文字 对应的索引打印出来:
# test = input(">>>")
# print(test) # test = qwe test[0] test[1]
# l = len(test) # l = 3
# print(l)
#
# r = range(0,l) # 0,3
# for item in r:
# print(item, test[item]) # 0 q,1 w,2 e
# test = input(">>>")
# for item in range(0, len(test)):
# print(item, test[item])
# 字符串一旦创建,不可修改
# 一旦修改或者拼接,都会造成重新生成字符串
# name = "zhengjianwen"
# age = "18"
#
# info = name + age
# print(info)
标签:bre 字母 习题 lse 不可 创建 存在 划线 pac
原文地址:https://www.cnblogs.com/sundanceS/p/12482894.html