摘要:
test = [1, 2, 3, 4, 5, 'a', 'b', 'c']test1 = 'kjhgfdsuytreaa'# 索引取值print(test[1])print(test[1:3])# for循环取值for i in range(len(test)): print(test[i])# 字 阅读全文
posted @ 2018-09-05 11:20
拎壶冲啊
阅读(111)
评论(0)
推荐(0)
摘要:
test = 'abcdefghk123456我的'# 字符串切索引print(test[0])# 字符串切片索引print(test[0:-1])# 字符串长度print(len(test))# 循环字符串count = 0while count < 17: print(test[count]) 阅读全文
posted @ 2018-09-05 11:19
拎壶冲啊
阅读(80)
评论(0)
推荐(0)
摘要:
test = 'abcdefjh'test2 = ' abcdefjh '# 字符串插入分隔print('#'.join(test))# 字符串固定长度左填充print(test.rjust(20, '@'))# 字符串固定长度右填充print(test.ljust(20, '@'))# 去掉左侧字 阅读全文
posted @ 2018-09-05 11:18
拎壶冲啊
阅读(127)
评论(0)
推荐(0)
摘要:
test = 'abcde123%'test1 = 'abcde123%fsadf\tdsfsdfsafadfsfqww'# 检查字符串中是否只包含数字或字母a = test.isalnum()print(a)# 检查字符串是字母f = test.isalpha()print(f)# 检查字符串是数 阅读全文
posted @ 2018-09-05 11:17
拎壶冲啊
阅读(105)
评论(0)
推荐(0)
摘要:
test = 'alexsdfada'# 首字母大写v = test.capitalize()print(v)test2 = 'aLBex'# 小写1(对未知的对应关系可转换小写)h = test2.casefold()print(h)test3 = 'aLex'# 小写2(适用通俗的小写转换)m 阅读全文
posted @ 2018-09-05 11:16
拎壶冲啊
阅读(207)
评论(0)
推荐(0)
浙公网安备 33010602011771号