如果字典类中可用,我只想复制字典
测试文件夹/dict.py
one={
"one1":"one1Data",
"one2":"one2Data",
"one2":"one3Data"}
two={
"two1":"two1Data",
"two2":"two2Data",
"two2":"two3Data"}
测试.py
import testfolder.dict as dictRef
print dictRef.two # it prints the dictionary)
但我想做的是复制字典(如果 dictRef 可用)
a='two'
if hasattr(dictRef, a): # this will not work but searching some alternate way to do..
c = dictRef.a # Jus trying to achieve this
print c # should print dictRef.two