當前位置:成語大全網 - 新華字典 - python學習變量賦值問題?

python學習變量賦值問題?

a, b, c, d = None, None, 'yyyy', 'aaaa'

dict_test = {'a': 'red', 'b': 'yellow', 'c': 'blue', 'd': 'black'}

for k, v in dict(globals()).items():

if v == None and k in dict_test:

globals()[k] = dict_test[k]

print(a, b, c, d)

#red yellow yyyy aaaa