x()exec(code, {}, {})
exec(code, globals(), locals()) # worksNameError: name 's' is not defined
当我们通过exec(code, globals(), locals())使用默认的全局变量和局部变量时如何让exec检测具有自定义作用域的<em
在PowerShell中,可以通过将声明前缀为类型名称来强制执行局部变量的类型:也可以使用新变量命令创建全局变量。New-Variable -Name MyGlobalOption -Scope Global -Value [MyEnum]'Option1'# This failsdue to invalid cast to [ActionPreference]
$ErrorActionPreference = Get-