标签:
本文主要介绍:字符串的索引,切片及求字符串的长度
代码:
#!/usr/bin/env python
# author by lh
# -*- coding:utf-8 -*-
s=‘hello‘
ret=len(s)
print ret
ret1=s[0:3]
print ret1
print s[0]
print s[1]
print s[2]
print s[3]
print s[4]
运行结果:
标签:
原文地址:http://www.cnblogs.com/pythonlh/p/5727512.html