美文网首页
2019-01-26 序列

2019-01-26 序列

作者: a35f9c03b68e | 来源:发表于2019-01-26 17:00 被阅读0次

emotion=["angry","happy","nervous","sad"]

元组0,1,2,3,或者逆序,-1-2-3-4

print(emotion[0:1])
['angry']
print(emotion[0:3])
['angry', 'happy', 'nervous']

打印小元组

print(emotion[3])
sad
print(emotion[-2])
nervous

打印元素

"hate"*5
'hatehatehatehatehate'

字符串多倍

"hate"+"you"
'hateyou'

字符串连接

"hate" in ("hate","you")
True

判断字符串

相关文章

网友评论

      本文标题:2019-01-26 序列

      本文链接:https://www.haomeiwen.com/subject/stiijqtx.html