Skip to content

Commit

Permalink
输出添加缩进
Browse files Browse the repository at this point in the history
  • Loading branch information
miyouzi committed Feb 24, 2020
1 parent 130061d commit 91e3795
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions akamTester.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
working_dir = os.path.dirname(os.path.realpath(__file__))
# working_dir = os.path.dirname(sys.executable) # 使用 pyinstaller 编译时,打开此项
ip_list_path = os.path.join(working_dir, 'ip_list.txt')
version = 3.2
version = 4.0


def ping_test(ip):
result = ping(ip, count=5)
delay = result.rtt_avg_ms
msg = ip + ' 平均延迟: ' + str(delay) + ' ms'
msg = ip + '\t平均延迟: ' + str(delay) + ' ms'
if delay<100:
color_print(msg, status=2)
else:
Expand Down Expand Up @@ -87,12 +87,12 @@ def ping_test(ip):
color_print('基于当前网络环境, 以下为延迟低于100ms的IP', status=2)
good_ips.sort(key=lambda x:x['delay'])
for ip in good_ips:
color_print(ip['ip'] + ' 平均延迟: ' + str(ip['delay']) + ' ms', status=2)
color_print(ip['ip'] + '\t平均延迟: ' + str(ip['delay']) + ' ms', status=2)
else:
ip_info.sort(key=lambda x:x['delay'])
color_print('本次测试未能找到延迟低于100ms的IP! 以下为延迟最低的 3 个节点', status=1)
for i in range(0,3):
color_print(ip_info[i]['ip'] + ' 平均延迟: ' + str(ip_info[i]['delay']) + ' ms')
color_print(ip_info[i]['ip'] + '\t平均延迟: ' + str(ip_info[i]['delay']) + ' ms')

print()
input('按回车退出')
Expand Down

0 comments on commit 91e3795

Please sign in to comment.