python 项目实战之随机杀死程序

 1 #!/usr/bin/env python
 2 # -*- coding: utf-8 -*-
 3 # @Time    : 2019/10/14 13:54
 4 # @Author  : zoulixiang
 5 # @Site    : 
 6 # @File    : ran_gman.py
 7 # @Software: PyCharm
 8 import random
 9 '''随机杀程序节点'''
10 def Ip_gman(file):
11     with open(file, 'r') as f:
12         data = f.read().split()
13         #print(data)
14     return data
15 
16 def Rand_gman(file):
17     data = Ip_gman(file)
18     ##    print(i)
19     datas = random.choice(data)
20     print(datas,"xxx")
21 
22 if __name__ == '__main__':
23     file = './IPLIST'
24     Rand_gman(file)
原文地址:https://www.cnblogs.com/zoulixiang/p/11671592.html