Python 混淆知识点集合

来源:互联网 发布:白色车牌js是什么意思 编辑:程序博客网 时间:2024/06/05 04:11

1,字符串和列表的更新异同:

  (1)均可更新

  (2)It's important to remember that lists are mutable (changeable) in Python, but strings aren't; when you slice a string, you get back a new string. The original string is unchanged unless you purposely "save over" it, like this:

my_string = "Monty Python"# => Monty Pythonmy_string = my_string[:-7]# => Monty   

0 0
原创粉丝点击