码迷,mamicode.com
首页 > 编程语言 > 详细

2018-7-7-Python练习

时间:2018-07-07 10:39:31      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:replace   索引   dex   range   class   upper   split   dea   join   

 7个基本掌握

join

split

find

strip

upper

lower

replace

 

进阶掌握

索引

切片

len

range

test = "abcdeabcfg"
v = test[4]
print(v)
w =  test[0:3]
print(w)
x = len(test)
print(x)

 

for循环

#while冗长,for的精简
test = "我是一个卧底"
# index = 0
# while index < len(test):
# v = test[index]
# print(v)
# index += 1
for i in test:
print(i)

 

2018-7-7-Python练习

标签:replace   索引   dex   range   class   upper   split   dea   join   

原文地址:https://www.cnblogs.com/lylyfly/p/9276277.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!