a = "i love love you you" from collections import Counter dict( Counter(list(a.split())) ) Out[103]: {'i': 1, 'love': 2, 'you': 2} 或者: s = '11AAAdfdfB ...
分类:
其他好文 时间:
2020-02-26 22:44:56
阅读次数:
76
list排序方法一Comparator形式: 1.比较数字 List<Shoes> all_shoes = new ArrayList<Shoes>(); Collections.sort(all_shoes, new Comparator<Shoes>(){ @Override /* * * in ...
分类:
编程语言 时间:
2020-02-24 12:40:26
阅读次数:
356
1. collections模块(扩展数据类型) 1. nametuple:可命名元组,生成可以使用名字来访问元素内容的tuple。(用来表示坐标,求圆的面积) from collections import namedtuple P = namedtuple("point",["x","y","z ...
分类:
编程语言 时间:
2020-02-24 11:20:48
阅读次数:
104
/* access 连接工具类 */ using System; using System.Collections.Generic; using System.Text; using System.Data.SqlClient; using System.Data; using System.Con ...
分类:
数据库 时间:
2020-02-23 20:43:33
阅读次数:
78
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Linq.Expressions; using ...
分类:
数据库 时间:
2020-02-23 19:53:14
阅读次数:
293
using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks ...
分类:
其他好文 时间:
2020-02-23 19:50:00
阅读次数:
63
可迭代对象: 1.生成器 2.元组,列表,集合,字典,字符串(需要借助iter()函数转换,变成了迭代器) 判断是否可迭代? 1 from collections import Iterable 2 3 # 列表 4 list1 = [1, 3, 4, 5] 5 f = isinstance(lis ...
分类:
其他好文 时间:
2020-02-23 16:31:21
阅读次数:
58
using System; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Text; using System.Collections.Generic; using M ...
分类:
数据库 时间:
2020-02-23 11:31:24
阅读次数:
76
给出第一印象:deque是一个双向队列 from collections import deque a = deque()a = deque(maxlen = 30) #限制长度 a.append(1) a.append(2) a.appendleft(3) print(a) Out[8]: deq ...
分类:
编程语言 时间:
2020-02-23 11:26:18
阅读次数:
70
1 import collections 2 class Solution: 3 def countBitOnes(self,num): 4 count = 0 5 for i in range(14): 6 if num & 1 == 1: 7 count += 1 8 num >>= 1 9 r ...
分类:
其他好文 时间:
2020-02-23 09:49:08
阅读次数:
62