二维矩阵转置
摘要:解析方法一: a的矩阵形态是3*3,即3行*3列, len(a[0]) 即取矩阵a的列的长度,用于转置后作为长的长度;内部再用row[col] 将矩阵的i行j列的数据放置在j行i列; 解析方法二: 之前一直很少去用zip和map函数,根据方法二,补充下关于zip和map两个区别于Python2时期直
阅读全文
posted @
2018-03-23 10:05
Zoe233
阅读(506)
推荐(0)
python 的特殊方法 __str__和__repr__
摘要:1.类的实例化返回值 1 class Foo(object): 2 def __init__(self): 3 pass 4 5 obj=Foo() 6 print(obj) 返回值:<__main__.Foo object at 0x0000000001E9AE48> 2.__str__方法: 1
阅读全文
posted @
2017-09-27 11:55
Zoe233
阅读(383)
推荐(0)
16.What is pass in Python?
摘要:What is pass in Python? Pass means, no-operation Python statement, or in other words it is a place holder in compound statement, where there shold be
阅读全文
posted @
2017-08-25 14:24
Zoe233
阅读(172)
推荐(0)
15.Why lambda forms in python does not have statements?
摘要:Why lambda forms in python does not have statements? A lambda form in python does not have statements as it is used to make new function object and th
阅读全文
posted @
2017-08-25 14:23
Zoe233
阅读(152)
推荐(0)
14.在Python中lambda函数是什么
摘要:在Python中lambda函数是什么? It is a single expression anoymous function often used as inline function. lambda 匿名函数 表达式及定义 lambda [ arg1 [arg2, arg3, … argN]
阅读全文
posted @
2017-08-25 13:38
Zoe233
阅读(370)
推荐(0)
13.Python中的命名空间是什么
摘要:Python中的命名空间是什么? In Python,every name introduced has a place where it lives and can be hooked for. This is known as namespace. It is like a box where
阅读全文
posted @
2017-08-25 11:09
Zoe233
阅读(356)
推荐(0)
12.Python提供了哪些内建类型
摘要:There are mutable and Immutable types of Pythons built in types Mutable built-in types: List Set Dictionary Immutable built-in types: String Tuple Num
阅读全文
posted @
2017-08-25 10:25
Zoe233
阅读(346)
推荐(0)
11.字典和列表生成式
摘要:字典和列表生成式 There are syntax constructions to ease the creation of a Dictionary or List based on existing iterable. 可以简化基于可迭代对象创建列表或字典的语法结构。 列表生成式List Co
阅读全文
posted @
2017-08-24 14:53
Zoe233
阅读(213)
推荐(0)
10.如何通过值或引用传递参数
摘要:如何通过值或引用传递参数? Everything in Python is an object and all variables hold references to the objects. The references values are according to the functions
阅读全文
posted @
2017-08-24 14:33
Zoe233
阅读(236)
推荐(0)
9.列表和元组的区别
摘要:列表和元组的区别 The difference between list and tuple is that list is mutable while tuple is not. Tuple can be hashed for as a key for dictionaries. list和tup
阅读全文
posted @
2017-08-24 13:32
Zoe233
阅读(312)
推荐(0)
8.Python中装饰器是什么?
摘要:Python中装饰器是什么? A Python decorator is a specific change that we make in Python syntax to alter functions easily. Python decorator是我们在Python语法中使用的一个特定的更
阅读全文
posted @
2017-08-23 15:17
Zoe233
阅读(251)
推荐(0)
7.哪些工具可以帮助查找bug或进行静态分析
摘要:哪些工具可以帮助查找bug或进行静态分析? PyChecker is a static analysis tool that detects the bugs in Python source code and warns about the style and complexity of the
阅读全文
posted @
2017-08-23 15:09
Zoe233
阅读(273)
推荐(0)
6.Python中内存是如何管理的?
摘要:Python中内存是如何管理的? Python memory is managed by Python private heap space. All Python objects and data structures are located in a private heap. The prog
阅读全文
posted @
2017-08-23 14:56
Zoe233
阅读(714)
推荐(0)
5.Python是怎么解释的?
摘要:Python是怎么解释的? Python language is an interpreted language. Python program runs directly from the source code. It converts the source code that is writt
阅读全文
posted @
2017-08-23 13:33
Zoe233
阅读(736)
推荐(0)
4.pickling 和unpickling是什么?
摘要:pickling 和unpickling是什么? Pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using dump f
阅读全文
posted @
2017-08-22 13:44
Zoe233
阅读(724)
推荐(0)
3.PEP 8是什么?
摘要:PEP 8是什么? PEP 8 is a coding convention, a set of recommendation, about how to write your Python code more readable. PEP 8是一种编码规范和建议,关于如何编写您的Python代码,使
阅读全文
posted @
2017-08-22 11:58
Zoe233
阅读(471)
推荐(0)
2.Python是什么?使用Python的好处是什么?
摘要:Python是什么?使用Python的好处是什么? 答: Python is a programming language with objects, modules, threads, exceptions and automatic memory management. The benefits
阅读全文
posted @
2017-08-22 11:18
Zoe233
阅读(1415)
推荐(0)
Redis介绍及字符串操作
摘要:一、前言 不同程序之间实现通信的方法? A.通过不同程序之间建立socket,实现通信。实际应用适用于使用broker,如RabbitMQ,ZeroMQ. B.通过Json,Pickle,利用文件的写入和读取实现不同程序之间的通信,但是效率低。 C.通过在不同的程序之间加入一个中间代理程序,中间代理
阅读全文
posted @
2017-08-22 10:42
Zoe233
阅读(200)
推荐(0)
字符串转换为二进制
摘要:符串如果直接全部都是utf-8编码,每个汉字有3个字节,每个英文有1个字节,1 bytes=8 bit。 先将字符串通过ord()转换为ascii码,再通过bin()将其转换为二进制。
阅读全文
posted @
2017-08-22 09:55
Zoe233
阅读(2233)
推荐(0)
上亿在线用户维护最高效的设计思想,二进制位存储变更的应用场景
摘要:应用场景:在某大型互联网公司,有上亿的用户,要统计当前用户的在线人数和在线用户id,最快的实现方法是什么? 答:一般情况下,我们都使用数据库字段在用户登陆状态发生变更时进行变更,查找在线人数和在线用户id都是用select的方式。但是这种方式在实际中,调取速度非常慢,效率比较低,时效性差。 在red
阅读全文
posted @
2017-08-21 17:10
Zoe233
阅读(483)
推荐(0)