在这个简单的场景中,我尝试通过python创建并转储一个json字符串,然后解析json转储并通过html打印它
Python:
import json
pythonDictionary = {'name':'Bob', 'age':44, 'isEmployed':True}
dictionaryToJson = json.dumps(pythonDictionary)
html和;js公司
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p id="messages"></p>
<p>My first paragraph.</p>
<script>
document.getElementById("messages").innerHTML = dictionaryToJson;
</script>
</body>
</html>
您可以像下面这样使用
python-shell
我假设
code.py
包含python代码相关问题 更多 >
编程相关推荐