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'

posted @ 2016-01-03 11:13  yufenghou  阅读(101)  评论(0编辑  收藏  举报