>>> globals()["d"] Traceback (most recent call last): File "", line 1, in KeyError: 'd' >>> globals()["d"]=2 >>> d 2