一.字符串 特性:字符串本身不可修改,除非字符串变量重新赋值.Python3中所有字符串都是Unicode字符串,支持中文. >>> name = "Jonathan" >>> name = "Jonathan" + "Ni" >>>print(name) Jonathan Ni # name 被重新赋值,并不是改变原先字符串 "Joanthan" 字符串运算符 实例
1.列表 # Filename: using_list.py # This is my shopping list shoplist=["apple", "mango", "carrot", "banana"] print ("I have", len(shoplist), "items to purchase.") print ("These items are:"