python 代码片段6


#coding=utf-8

# python常用的列表list和字符串string
# tuple元组,一个身有残疾的只读列表

s='python'
print s[0]
print s[-1]

# 序列切片

print s[1:4]
print s[3:]
print s[:3]
print s[:]

# 字符串连接 连接+ 复制* 检查是否是成员 in 和 not in

print 'python and '+'django are cool'
print 'python and '+''+'django are cool'
print '-'*40
print 'ang' in 'django'
print 'ang' not in 'django'

原文地址:https://www.cnblogs.com/yufenghou/p/5095922.html