小编dsa*_*avi的帖子

如何在字符串中获取给定名称的变量的值?

为简单起见,这是我想要做的精简版:

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)

有什么办法吗?

python string variables

66
推荐指数
4
解决办法
9万
查看次数

如何在html5画布上绘制圆形扇区?

我试图在canvas元素上制作一种饼图形状,但是我似乎无法找到任何单独执行此操作的函数.我似乎只能绘制完整的圆圈和片段.是否有捷径可寻?

(另见:关于圈子术语的维基百科)

html5 geometry canvas sector geometric-arc

15
推荐指数
1
解决办法
2万
查看次数

标签 统计

canvas ×1

geometric-arc ×1

geometry ×1

html5 ×1

python ×1

sector ×1

string ×1

variables ×1