通过反射获得对象的方法 准备工作: 有一个User类如下 package o1; /** * Created by yesiming on 16-11-19. */ public class User { private int id; private String name // 无参构造方法 public User() { System.out.println("new Instance() 1"); } // 有参构造方法 public User(int id, String n…
#!/usr/bin/python #coding=utf8 log_file = "/usr/local/nginx/logs/access.log" with open(log_file) as f: contexts = f.readlines() # define ip dict### ip = {} # key为ip信息,value为ip数量(若重复则只增加数量) flow = {} # key为ip信息,value为流量总和 sum = 0 for line in cont…