Discuss / Python / 打卡

打卡

Topic source

與生懼來

#1 Created at ... [Delete] [Delete and Lock User]

(1, [2, 3])即使作为tuple也不能放入dict和set里成为key,但是可以作为value值

#!/usr/bin/env python

# -*- encoding: utf-8 -*-

keyname='元素1'

t=(1,[2,3])

d={}

d[keyname] = t

print(d.get(keyname),d.get(keyname)[1][1])

(1, [2, 3] 3)


  • 1

Reply