摘要: #使用{}的方法 s1 = 'Hello {}! My name is {}.'.format('World', 'Python猫') print(s1) s2 = 'Hello {0} My name is {1}.'.format('world','Python 猫') print(s2) s3 = 'Hello {name1}! My name is {name2}.'.format(... 阅读全文
posted @ 2018-12-14 23:02 萧白白 阅读(32209) 评论(0) 推荐(0) 编辑
摘要: >>> list1 = [1,2] >>> id(list1) 50081032 >>> list2 = list1.copy() >>> print(list1 == list2) True >>> id(list2) 50081352#几种字符串复制方法,id相同 >>> s0 ='Python猫' >>> s1 = s0 >>> s2 = str(s0) >>> s3 = s0[:] >>... 阅读全文
posted @ 2018-12-14 21:06 萧白白 阅读(13852) 评论(0) 推荐(0) 编辑