|  | 
 
| 
我做的一个小项目,里面涉及一个数组问题不知道怎么解决,求大神
x
马上注册,结交更多好友,享用更多功能^_^您需要 登录 才可以下载或查看,没有账号?立即注册  我做一个合同自动生成的小项目
 里面借款合同要关联保证合同和抵押合同
 我设定一个数组,比如说
 fill_list = _map([data.get('保证人1'), data.get('保证人2'), data.get('抵押人1'), data.get('抵押人2')])
 car_list = _map([data.get('保证人1身份证'), data.get('保证人2身份证'), data.get('抵押人1身份证'), data.get('抵押人2身份证')])
 我调用的时候就很正常
 
 但是呢,另外一个位置,我用的数组,第二个数组里面涉及重复性的信息(只有保证合同编号和抵押合同编号)
 我调用就会出现一些莫名其妙的问题
 fill_list1 = _map([data.get('保证人1'), data.get('保证人2'), data.get('保证人3'), data.get('抵押人1'), data.get('抵押人2'), data.get('抵押人3')])
 hetong = _map([data.get('保证合同编号'), data.get('保证合同编号'), data.get('保证合同编号'),data.get('抵押合同编号'), data.get('抵押合同编号'), data.get('抵押合同编号')])
 elif run.text.strip() == '14':
 if len(fill_list1) > 0:
 run.text = fill_list1[0]
 else:
 run.text = ''
 elif run.text.strip() == '15':
 if len(fill_list1) > 1:
 run.text = fill_list1[1]
 else:
 run.text = ''
 elif run.text.strip() == '16':
 if len(fill_list1) > 2:
 run.text = fill_list1[2]
 else:
 run.text = ''
 elif run.text.strip() == '17':
 if len(fill_list1) > 3:
 run.text = fill_list1[3]
 else:
 run.text = ''
 elif run.text.strip() == '18':
 if len(fill_list1) > 4:
 run.text = fill_list1[4]
 else:
 run.text = ''
 elif run.text.strip() == '19':
 if len(fill_list1) > 5:
 run.text = fill_list1[5]
 else:
 run.text = ''
 
 
 elif run.text.strip() == '20':
 if len(hetong) > 0:
 run.text = hetong[0]
 else:
 run.text = ''
 elif run.text.strip() == '21':
 if len(hetong) > 1:
 run.text = hetong[1]
 else:
 run.text = ''
 elif run.text.strip() == '22':
 if len(hetong) > 2:
 run.text = hetong[2]
 else:
 run.text = ''
 elif run.text.strip() == '23':
 if len(hetong) > 3:
 run.text = hetong[3]
 else:
 run.text = ''
 elif run.text.strip() == '24':
 if len(hetong) > 4:
 run.text = hetong[4]
 else:
 run.text = ''
 elif run.text.strip() == '25':
 if len(hetong) > 5:
 run.text = hetong[5]
 else:
 run.text = ''
 
 
 具体问题是,如果我只存在抵押人1和抵押人2,那么输出的时候会产生抵押人1和抵押人2,同时对应3个抵押合同编号
 实际上我抵押人3是空的,也就是说第二个hetong = _map数组里面应该是2个数据,为啥会显示3个呢?
 | 
 |