紧挨着 组合  a b c d  ----> ab ,bc ,cd 

portList = ['a', 'b', 'c', 'd']
for i, p in enumerate(portList):
    if i == len(portList) - 1:
        break
        # p, portList[i + 1]
    print p
    print portList[i + 1]
    print "------"

第一个 ,分别 与 后面的组合  a b c d ----> ab,ac,ad

    for i in range(0, len(portList)):
        for u in range(1, len(portList)):
            reList.append({
                'a': portList[i]['PORT_CODE'].encode('utf-8'),
                'b': portList[u]['PORT_CODE'].encode('utf-8')
            })
        break

 

相关文章:

  • 2021-12-01
  • 2022-12-23
  • 2021-11-19
  • 2021-05-06
  • 2021-09-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2021-10-10
  • 2022-12-23
  • 2021-11-19
  • 2021-05-24
相关资源
相似解决方案