摘要:unittest 提供了一组测试函数,可以用来特化测试,如assertDictEqual、assertEqual、assertTrue、assertFalse、assertGreater、assertGreaterEqual、assertIn、assertIs、assertIsIntance、ass
阅读全文
摘要:pip install pylint pip install pyflakes pylint style1.py pip install pep8 pep8 style3.py
阅读全文
摘要:字节和字节数组 struct binascii 位运算符
阅读全文
摘要:mysql分页原理和高效率的mysql分页查询语句
阅读全文
摘要:使用%的旧式格式化 使用%的旧式格式化 使用%的旧式格式化 使用%的旧式格式化 使用%的旧式格式化 使用{}和format的新式格式化 使用{}和format的新式格式化 使用{}和format的新式格式化 使用{}和format的新式格式化 使用{}和format的新式格式化
阅读全文
摘要:from collections import namedtuple Duck = namedtuple('Duck', 'bill tail') duck = Duck('wide orange', 'long') print(duck) #Duck(bill='wide orange', tail='long') print(duck.bill) #wide orange Duck2 = ...
阅读全文
摘要:存储数据结构到一个文件中也称为序列化。像json这样的格式需要定制的序列化数据的转换器。python提供了pickle模块以特殊的二进制格式保存和恢复数据对象
阅读全文
摘要:settings.cfg test.py python3 test.py
阅读全文
摘要:字符串 列表 哈希表 集合 有序集合 位图 缓存和过期
阅读全文
摘要:import dbm db = dbm.open('definitions', 'c') db['mustard'] = 'yellow' db['ketchup'] = 'red' db['pesto'] = 'green' print(len(db)) #3 print(db['pesto']) #b'green' db.close() db = dbm.open('definitio...
阅读全文
摘要:Lucene 或者 solr 有什么不一样? 分别何时使用?
阅读全文
摘要:def another_palindrome(word): return word == word[::-1] #word[::-1]字符串反转 another_palindrome('aba')
阅读全文
摘要:setdefault和defaultdict 输出 pprint itertools 输出 deque OrderedDict Counter计数
阅读全文