Xiang Zhang added the comment: Not a bug. Put the global statement inside:
>>> variable = 'test' >>> def changeVariable(): ... exec("global variable; variable = 'newText'") ... >>> changeVariable() >>> print(variable) newText ---------- nosy: +xiang.zhang resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28064> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com