代码拉取完成,页面将自动刷新
# li = ('w','e','u','g')
# print(str.join(li))
#列表生成器
# print([i for i in range(1,10)])
#
# li = [i*(i+1) for i in range(1,10)]
# print(li)
# str = "hello, my name is as,I am 25 years old this year";
#
# print(str.isdecimal())
# if '25 years' in str:
# print("25 years")
# else:
# print('找不到')
# string = "Hello World"
# index = string.index('o')
# print(index)
# str = "hello, my name is as,I am 25 years old this year"
# for i in str.split(' '):
# if i.isdigit():
# print(i)
# print(str[2:3]) #使用截取方式,用正序进行截取
# print(str[2:-6])#使用截取方式,正序和倒序混合使用
# print(str[-7:-6])#使用截取方式,使用倒序进行截取
# print(str[-7])#使用负索引获取单个字符C
# print(str[2])#使用正索引获取单个字符C
# str="W3cschool"
# print(str[:3])
# print(str[-6:-3])
# name = "小明"
# age = 10
# print('我叫 %s 今年 %d 岁!'%(name,age))
# x = 1
# print(f'{x+1}')
# print(f'{x+1=}')
# str = 'abc def'
# print(str.title())
# print(str.capitalize())
# str = "[helloworld]"
# print(str.center(40,'*'))
# str = "helloworld"
# sub = 'o'
# print(str.count(sub))
# print(str.count('o',0,10))
# print(str.count('l',0,10))
# str = 'Helloworld教程'
# str_utf8 = str.encode("UTF-8")
# str_gbk = str.encode("GBK")
# print(str)
# print("UTF-8 编码",str_utf8)
# print("GBK 编码",str_gbk)
# str = "W3Cschool教程";
# str_utf8 = str.encode("UTF-8")
# str_gbk = str.encode("GBK")
#
# print(str)
#
# print("UTF-8 编码:", str_utf8)
# print("GBK 编码:", str_gbk)
#
# print("UTF-8 解码:", str_utf8.decode('UTF-8','strict'))
# print("GBK 解码:", str_gbk.decode('GBK','strict'))
# Str = "helloworld!!!!!"
# suffix = "!!!!!"
# print(Str.endswith(suffix))
# print(Str.endswith(suffix,20))
# str1 = "helloworldass"
# str2 = "ass"
#
# print(str1.find(str2))
#
# print(str1.find('w',0,6))
# str1 = "helloworldass"
# str2 = "ass"
#
# print(str1.index(str2))
# #
# # print(str1.index('w',0,2))
# print(str1.index('w',0,7))
# str = "you121212"
# print(str.isalnum())
# str1 = "wewe..wewe"
# print(str1.isalnum())
# str = "helloworld"
# str = "1234556"
# print(str.isalpha())
# str = '121212121'
# str1 = 'helloworld123456789'
# print(str.isdigit())
# print(str1.isdigit())
# print(str.isnumeric())
# print(str1.isnumeric())
# str = 'helloworld'
# print(str.islower())
# str = "helloworld "
# str1 = " "
# print(str.isspace())
# print(str1.isspace())
# str = "Hello World Ass"
# print(str.istitle())
# str1 = "Hello world ass"
# print(str1.istitle())
# str = "HELLO WORLD ASS"
# print(str.isupper())
# str1 = "hello world ass"
# print(str1.isupper())
# str1 = "-"
# str2 = "*"
# seq = ("h","e","l","l","o","w","o","r","l","d")
# print(str1.join(seq))
# print(str2.join(seq))
# len
# str = "hello world , My name is Ass"
# print(len(str))
# list = ['h','e','l','l','o']
# print(len(list))
# dict = {'name':'ass','age':18,'height':170}
# print(len(dict))
# ljust rjust
# str = 'hello world'
# print(str.ljust(30,'$'))
# print(str.rjust(30,'$'))
# lower
# str = 'HELLO WOLRD'
# print(str.lower())
# lstrip()
# str = ' hello world'
# str1 = 'hhello world '
# str2 = 'hello worlddddd'
# print(str.lstrip())
# print(str1.rstrip())
# print(str1.lstrip('h'))
# print(str2.rstrip('d'))
# maketrans() ????
# str1 = 'ass'
# str2 = '234'
#
# str = 'this is string example'
# str3 = str.maketrans(str1,str2)
#
# print(str.translate(str3))
# max min
# str = 'hello world'
# print(max(str))
# # print(min(str)) 输出空格
# str1 = 'HelloWorld'
# print(min(str1))
# str2 = 'helloworld'
# print(min(str2))
# replace()
# str = 'hello world , my name is ass , I am learn python'
# print(str)
# print(str.replace('python','python3'))
# print(str.replace('o','WW',3))
# print(str.replace('o','WW',2))
# rfind()
# str = 'hello world , my name is ass , I am learn python'
# print(str.rfind('o'))
# print(str.rfind('o',0,10))
# print(str.rfind('o',5,0))
#
# print(str.find('o'))
# print(str.find('o',0,10))
# print(str.find('o',10,0))
#rindex
# str = 'hello world'
# print(str.index('e'))
# print(str.index('o',0,9))
# # print(str.rindex('o',0,5))
# print(str.rindex('o',0,8))
# rjust
# str = 'hello world'
# print(str.rjust(40,'*'))
# print(str.ljust(40,'*'))
# split
# str = 'hello world,My nameo iso ass'
# print(str.split())
# # print(str.split('o',3))
# print(str.split('w'))
# splitlines
# str = "this is \nstring example....\nwow!!!"
# print(str.splitlines())
# startswith()
# str = "this is string example....wow!!!"
# print(str.startswith('this'))
# print(str.startswith('is',2))
# print(str.startswith('is',8))
# print(str.startswith('this',1,4))
#swapcase()
# str = 'HELLO WORLD'
# str1 = 'hello world'
# str3 = 'Hello World'
# print(str.swapcase())
# print(str1.swapcase())
# print(str3.swapcase())
# upper
# str = "this is string example from w3cschool....wow!!!";
# print (str.upper())
# title()
# str = "this is string example from youj....wow!!!"
# print (str.title())
# translate
# intab = "aeiou"
# outtab = "12345"
# trantab = str.maketrans(intab, outtab)
#
# str = "this is string example....wow!!!"
# print (str.translate(trantab))
# zfill
# str = "this is string example from youj....wow!!!"
# print (str.zfill(40))
# print (str.zfill(50))
# isdecimal
str = "youj2016"
print (str.isdecimal())
str = "23443434"
print (str.isdecimal())
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。