为简单起见,这是我想要做的精简版:
def foo(a):
# I want to print the value of the variable
# the name of which is contained in a
Run Code Online (Sandbox Code Playgroud)
我知道如何在PHP中执行此操作:
function foo($a) {
echo $$a;
}
global $string = "blah"; // might not need to be global but that's irrelevant
foo("string"); // prints "blah"
Run Code Online (Sandbox Code Playgroud)
有什么办法吗?
我试图在canvas元素上制作一种饼图形状,但是我似乎无法找到任何单独执行此操作的函数.我似乎只能绘制完整的圆圈和片段.是否有捷径可寻?
(另见:关于圈子术语的维基百科)