我试图使用Python检索Javascript变量,但遇到了一些问题。。。
变量如下:
<script type="text/javascript">
var exampleVar = [
{...},
{...},
{
"key":"0000",
"abo":
{
"param1":"1"
"param2":"2"
"param3":
[
{
"param3a1":"000"
"param3a2":"111"
},
{
"param3b1":"100"
"param3b2":"101"
}
]
}
]
</script>
经过一番研究,我发现它的内容是JSON格式的,我对它很陌生。。。
我现在的问题是,我想检索“param3b1”的值(例如),以便在Python程序中使用它。
如何在Python中执行此操作?
谢谢!
您需要使用JSON模块。
JSON模块文档:https://docs.python.org/2/library/json.html
一步一步这是你需要做的。
<script>
标记之间的字符串,然后获取变量定义这是一个演示。
相关问题 更多 >
编程相关推荐