At this point, I have two things to understand.
import json
j = {
"employee":
[
{"id": 111,"name": "John"},
{"id": 222,"name": "Elle"}
]
}
print(j)
a = json.dumps(j)
print(json.dumps(a))
with open('test.json','w') as f:
json.dump(j,f)
with open('test.json','r') as f:
print(json.load(f)) #Read and write the output file in the file.
Getting page elements using Ajax.
$.ajax({
url: "./information.json",
dataType: "json"
})
.done(function(json){
var idx = 0;
var $info = $(".info__list .item");
$info.find("time").text(json[idx].date);
$info.find("p").text(json[idx].value);
setInterval(function(){
if(idx === json.length -1){
idx = 0;
} else {
idx = idx + 1;
}
$info.css("opacity",0);
setTimeout(function(){
$info.find("time").text(json[idx].date);
$info.find("p").text(json[idx].value);
$info.css("opacity",1);
},500);
},5000)
});
It seems that you can get the information of the web page by a third party called requests. Let's also check the code for acquiring JavaScript information.
Recommended Posts