Python locals()

Configurare noua (How To)

Situatie

locals() method updates and returns the dictionary associated with the current local symbol table.

Solutie

Pasi de urmat

def localsNotPresent():
return locals()

def localsPresent():
present = True
return locals()

print(‘localsNotPresent:’, localsNotPresent())
print(‘localsPresent:’, localsPresent())

Output:

localsNotPresent: {}
localsPresent: {‘present’: True}

Tip solutie

Permanent

Voteaza

(8 din 18 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?