摘要:
# 1.创建一个空列表,命名为names,往里面添加Lihua、Rain、Jack、Xiuxiu、Peiqi和Black元素。# names=list()# names.append('Lihua')# names.append('Rain')# names.append('Jack')# name 阅读全文
posted @ 2022-06-22 21:09
爱coding的果妈
阅读(269)
评论(0)
推荐(0)
摘要:
元组tuple 和列表非常相似,唯一区别:元组是不可变的列表元组的初始化 1 # tup1=() 2 # print(tup1,type(tup1)) 3 # 4 # tup2=tuple() 5 # print(tup2,type(tup2)) 6 7 # tup2=(1) #这个不是元组 8 # 阅读全文
posted @ 2022-06-22 21:06
爱coding的果妈
阅读(30)
评论(0)
推荐(0)
摘要:
#列表的初始化 1 # lst=[] #创建一个空列表 2 # lst1=list() #创建一个空列表 3 # print(lst,type(lst)) 4 # print(lst1,type(lst1)) #字符串转列表 把字符串值一个个取出来 1 # str1='hello world' 2 阅读全文
posted @ 2022-06-22 21:06
爱coding的果妈
阅读(107)
评论(0)
推荐(0)
摘要:
#索引 index#索引位从0开始,不能越界,可以正着取,也可以倒着取# str1='helloworld'# print(str1[0])# print(str1[-1]) #-1 取最后一个元素# 遍历字符串str1='helloworld',把值一个个取出来# str1='helloworld 阅读全文
posted @ 2022-06-22 21:05
爱coding的果妈
阅读(58)
评论(0)
推荐(0)
摘要:
#utf-8可变长的编码--节省空间#如果是英文字母 8位 1字节#如果是欧洲文字 16位 2字节#中国文字 24位 3字节s ='你好,朋友's_byte = s.encode( ' utf-8 ' )#unicode -->utf-8#转成16进制的字节print(s_byte)s2=s_byt 阅读全文
posted @ 2022-06-22 21:04
爱coding的果妈
阅读(46)
评论(0)
推荐(0)
摘要:
#赋值运算符 # num+=1 # num-=1 # num*=1 #身份运算符 1 # a=1 2 # b=1 3 # print(a==b) #判断值是否相等 4 # print(a is b) # 判断内存地址是否相同 5 # #id() #查看内存地址 6 # print(id(a)) 7 阅读全文
posted @ 2022-06-22 21:03
爱coding的果妈
阅读(157)
评论(0)
推荐(0)
浙公网安备 33010602011771号