我下载了一个看起来像PHP数组文件的文件,想知道是否有python模块或其他将数组转换/导入python字典的方法。 下面是PHP数组文件开头的示例。在
<?php
$legendre_roots = array();
$legendre_roots[2] = array(
-0.5773502691896257645091487805019574556476017512701268760186023264839776723029333456937153955857495252252087138051355676766566483649996508262705518373647912161760310773007685273559916067003615583077550051041144223011076288835574182229739459904090157105534559538626730166621791266197964892168,
0.5773502691896257645091487805019574556476017512701268760186023264839776723029333456937153955857495252252087138051355676766566483649996508262705518373647912161760310773007685273559916067003615583077550051041144223011076288835574182229739459904090157105534559538626730166621791266197964892168);
理想情况下,我想要一本字典,例如:
^{pr2}$感谢任何帮助。在
在我决定没有时间去处理JSON和PHP的复杂性之后,我决定编写一个python脚本来完成这项工作。它是基于纯文本处理的,如果需要的话可以被其他人修改。原文如此:
是的,它对我的情况非常特殊,但是如果有时间修改代码,并且在PHP-JSON方面得不到太多帮助,可能会对他们有所帮助。在
在PHP代码中添加一个小snipet,JSON对数组进行编码,并将其显示/存储在磁盘上。在
您可能可以直接使用该JSON代码。如果不是,用python解码并
pprint
它。在一个例子
相关问题 更多 >
编程相关推荐