- 博客(10)
- 资源 (2)
- 收藏
- 关注
原创 问题总结
Pythonpymysql不能实时查询最新的数据InnoDB 的默认隔离级别。它可以防止任何被查询的行被其他事务更改,从而阻止不可重复的读取,而不是 幻读取。它使用中度严格的锁定策略,以便事务内的所有查询都会查看同一快照中的数据,即数据在事务开始时的数据。那么此时问题就找到了,跟当前的事务级别有关系的;当创建查询事务时,事务一直没有进行更新,每次查询到的数据都是之前查询结果的快照。解决...
2020-01-07 14:50:30 102
原创 python copy
实际使用中,可能需要的是将里面的内容给复制出来到一个新的地址空间,这里可以使用python的copy模块,copy模块分为两种拷贝,一种是浅拷贝,一种是深拷贝。假设处理一个list对象,浅拷贝调用函数copy.copy(),产生了一块新的内存来存放list中的每个元素引用,也就是说每个元素的跟原来list中元素地址是一样的。所以从下面例子中可看出当原list中要是包含list对象,分别在a和b对l...
2019-09-27 17:31:54 122
原创 Hash in python
A hash is an fixed sized integer that identifies a particular value. Each value needs to have its own hash, so for the same value you will get the same hash even if it’s not the same object.hash(“...
2019-09-27 17:30:09 267
原创 Python3 的六个标准数据类型
Python3 的六个标准数据类型中:• 不可变数据(3 个):Number(数字)、String(字符串)、Tuple(元组);可变数据(3 个):List(列表)、Dictionary(字典)、Set(集合)。...
2019-09-27 17:29:30 137
原创 Subclass inherit , override class method
class Person:def init(self, first, last, age):self.firstname = firstself.lastname = lastself.age = agedef str(self):return self.firstname + " " + self.lastname + ", " + str(self.age)class Emplo...
2019-09-27 17:28:15 109
原创 what's the meaning of %r in python
In Python, there are two builtin functions for turning an object into a string: str vs. repr. str is supposed to be a friendly, human readable string. repr is suppos...
2019-09-27 17:26:18 237
原创 Difference between __str__ and __repr__ in Python
First, let me reiterate the main points in Alex’s post:• The default implementation is useless (it’s hard to think of one which wouldn’t be, but yeah)• repr goal is to be unambiguous• str ...
2019-09-27 17:25:41 128
原创 python杂记
pythonTurn a list or tuple to stringprint ', '.join(str(x) for x in list_of_ints)Orprint ', '.join([str(x) for x in list_of_ints])The *args and **kwargs is a common idiom to a...
2019-09-27 17:23:42 313
原创 css selector and xpath
css selector and xpath.element .symbol (a space in middle)means .symbol inside .element.element.symbol (no space)means .element that has the c...
2019-09-27 17:15:46 171
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人