collections collections是Python内建的一个集合模块,提供了许多有用的集合类。 nametuple是一个函数,它用来创建一个自定义的tuple对象,并且规定了tuple元素的个数,并可以用属性而不是索引来引用tuple的某个元素。这样一来,我们用namedtuple可以很方 ...
分类:
编程语言 时间:
2021-05-24 14:16:35
阅读次数:
0
with open('data1_1.txt', 'r', encoding = 'utf-8') as f: data=f.readlines()n = 0for line in data: if line.strip('\n') == '': continue n+=1print(f'共{n}行 ...
分类:
其他好文 时间:
2021-05-24 14:12:19
阅读次数:
0
Given a tree, you are supposed to list all the leaves in the order of top down, and left to right. Input Specification: Each input file contains one t ...
分类:
其他好文 时间:
2021-05-24 14:03:04
阅读次数:
0
Java特性和优势 简单性 面向对象 可移植性 高性能 分布式 动态性 多线程 安全性 健壮性 ...
分类:
编程语言 时间:
2021-05-24 13:44:34
阅读次数:
0
1.安装插件:compression-webpack-plugin npm i -D compression-webpack-plugin 我用的插件在package.json中的版本如下: "devDependencies": { "compression-webpack-plugin": "^3 ...
分类:
Web程序 时间:
2021-05-24 13:37:41
阅读次数:
0
1、关于列表存储数据 2、给定数据,查找数据所在位置;index()在的话则返回所在的位置,不在的话报错 ;str.index('',开始下标,结束下标) 3、count() 统计给定数据在列表出现的次数 4、判断给定数据是否在列表中 in 在的话返回true,不在的话返回false; 5、判断给定 ...
分类:
编程语言 时间:
2021-05-24 13:27:03
阅读次数:
0
# print()# input()# len()# type()# int()# str()# list()# tuple()# dict()# set()# float()# id() # avg = sum(l) / len(l) #计算平均值# print(avg)# print( max( ...
分类:
编程语言 时间:
2021-05-24 13:23:00
阅读次数:
0
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, ...
分类:
其他好文 时间:
2021-05-24 13:17:05
阅读次数:
0
泛型 1 泛型存在的目的 类型参数化,模板化编程,简化编程 2 泛型的原理 java的泛型参数在运行时会进行类型擦除,擦除后就是object,编译器也会转成object进行编译 那么为啥使用泛型呢? 更加安全 更好的可读性 3 泛型的使用 最常用的容器类比如List 泛型类 class Pair2< ...
分类:
编程语言 时间:
2021-05-24 13:12:20
阅读次数:
0
前言 在任何编程语言中,关乎到数据的排序都会有对应的策略,我们来看下 Golang 是怎样对数据进行排序,以及我们如何优化处理使用 go 排序 go 可以针对任何对象排序,虽然很多情况下是一个 slice 切片,或者是包含 slice 的一个对象。 go 排序(接口)有三个要素: 待排序元素个数 n ...
分类:
编程语言 时间:
2021-05-24 13:04:56
阅读次数:
0