connect.py
来自「用于OMNeT++的模板」· Python 代码 · 共 23 行
PY
23 行
#!/usr/bin/pythonimport re,syspatt = re.compile("(\d+):((?:[ \t]+\d+)+)")anctotal = 0nontotal = 0count = 0for x in sys.stdin.readlines(): data = patt.search(x) if data!=None: index = int(data.group(1)) if index>110: # highest anchor nodes = [int(x) for x in data.group(2).split(' ') if x!=''] anctotal += len(nodes) nontotal += len([z for z in nodes if z>110]) count +=1.0print "Connectivity (with anchors) = ",anctotal/countprint "Connectivity (without anchors) = ",nontotal/count
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?