求集合里元素的个数 输出最大的个数是多少 Sample Input41 23 45 61 641 23 45 67 8 Sample Output42 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <cmath> # include <queue> # define LL long long usi
// 有一个集合,判断集合里有没有“world”这个元素,如果有,添加“javaee” List list = new ArrayList(); list.add("world"); list.add("java"); list.add("hello"); //ConcurrentModificationException /*Iterator it = list.iterator(); while(it.hasNext()){ String s
#!/usr/bin/env python ''' 处理访问日志,筛选时间大于1秒的请求 ''' with open('test.log','a+',encoding='utf-8') as f_a: with open('wkxz-api.access.log') as f: for line in f.readlines(): if line[-2:] == "-\n" : num =float(line[-7:-2]) else: num=float(line[-6:]) if
处理nginx访问日志,筛选时间大于1秒的请求 #!/usr/bin/env python ''' 处理访问日志,筛选时间大于1秒的请求 ''' with open('test.log','a+',encoding='utf-8') as f_a: with open('wkxz-api.access.log') as f: for line in f.readlines(): if line[-2:] == "-\n" : num =float(line[-7:-2]) else
列表,字典,集合中根据条件筛选数据,如下所示 列表:[-10,2,2,3,-2,7,6,9] 找出所有的非负数 字典:{1:90,2:55,3:87...} 找出所有值大于60的键值对 集合:{2,3,8,6,7,5} 找出所有被3整除的数 列表 >>> from random import randint >>> data = [randint(-10,10) for x in xrange(10)] >>> data [-1, 8, -9, 9,
1.输入班级人数,统计每个人的姓名,性别,年龄:集合与数组 //Console.Write("请输入班级人数:"); //int a = int.Parse(Console.ReadLine()); //ArrayList al = new ArrayList(); //for (int i = 0; i < a;i++ ) //{ // string [] name =new string[3]; // Console.Write("请输入第{0}个人的姓名:&quo