json增删改查

<!DOCTYPE html>
<html>


<head>
<meta charset="UTF-8">
<title></title>
<script src="js/angular.min.js"></script>
<style>
#q tr td {
width: 150px;
text-align: center;
margin-bottom: 5px;
}

#q tr:nth-child(2n) {
background: darkgray;
}

#q tr:nth-child(odd) {
background: white;
}
span{
color: red;

}
</style>
<script>
angular.module("lizhuang", [])
.controller("democ", function($scope, $http) {
$http.get("http://result.eolinker.com/TucCTQueffdc1d1aaa3be05d8c62e9bb5d3e8b495f97cca?uri=hybrid")
.then(function(d) {
$scope.persons = d.data;
$scope. add_sex='男';
});
$scope.getAge = function(bir) {
var b = new Date(bir).getYear(); //出生的年份
var nowb = new Date().getYear(); /*现在的年份*/
return nowb - b;
}


$scope.bumen = function(dname) {
if($scope.bumencha == undefined || $scope.bumencha == "") {
return true;
}


if(dname.indexOf($scope.bumencha) > -1) {
return true;
}
return false;
}
//删除
$sco
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Python中,可以使用json模块来操作JSON数据格式。以下是一些基本的JSON操作: 1. 将Python对象转换为JSON格式: ```python import json # 定义一个Python字典 person = {'name': 'Tom', 'age': 20, 'gender': 'male'} # 将字典转换为JSON格式 person_json = json.dumps(person) print(person_json) # 输出结果:{"name": "Tom", "age": 20, "gender": "male"} ``` 2. 将JSON格式字符串转换为Python对象: ```python import json # 定义一个JSON格式字符串 person_json = '{"name": "Tom", "age": 20, "gender": "male"}' # 将JSON格式字符串转换为Python对象 person = json.loads(person_json) print(person) # 输出结果:{'name': 'Tom', 'age': 20, 'gender': 'male'} ``` 3. 从JSON文件中读取数据: ```python import json # 读取JSON文件中的数据 with open('data.json', 'r') as f: data = json.load(f) print(data) ``` 4. 将数据写入JSON文件: ```python import json # 定义一个Python字典 person = {'name': 'Tom', 'age': 20, 'gender': 'male'} # 将Python字典写入JSON文件 with open('data.json', 'w') as f: json.dump(person, f) ``` 5. 修改JSON数据: ```python import json # 读取JSON文件中的数据 with open('data.json', 'r') as f: data = json.load(f) # 修改数据 data['age'] = 21 # 将修改后的数据重新写入JSON文件 with open('data.json', 'w') as f: json.dump(data, f) ``` 6. 删除JSON数据: ```python import json # 读取JSON文件中的数据 with open('data.json', 'r') as f: data = json.load(f) # 删除数据 del data['gender'] # 将修改后的数据重新写入JSON文件 with open('data.json', 'w') as f: json.dump(data, f) ``` 以上就是一些基本的JSON操作,可以根据具体需求进行扩展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值