python笔试陷阱1

2020-12-13 05:04

阅读:354

标签:http   为什么   笔试   pre   原因   src   pytho   python   com   

test_list = [ {‘data‘: 1, ‘no‘: 301}, {‘data‘: 2, ‘no‘: 401}, {‘data‘: 4, ‘no‘: 201}, {‘data‘: 6, ‘no‘: 101}, {‘data‘: 5, ‘no‘: 303} ] new_list = list(test_list) # print(new_list) for match in test_list: if match[‘no‘] > 300: match[‘no‘] = ‘BF‘ else: match[‘no‘] = ‘BR‘ # print(test_list) new_list[1][‘data‘] = 7 new_list.pop() print(test_list) print(new_list)

为什么结果不一样?

原因:
技术图片
dict()也同样

python笔试陷阱1

标签:http   为什么   笔试   pre   原因   src   pytho   python   com   

原文地址:https://blog.51cto.com/9460124/2416859


评论


亲,登录后才可以留言!