摘要:
1. dict represents a dictionary use dict.get('e',0) instead of dict['e'] to get the value of 'e' if you are not sure that 'e' is included in dict 阅读全文
摘要:
1.Suggest that testing equality of floats is not exact – Use abs(x-y) < 0.0001, rather than x == y2. str.swapcase():upper to lower,lower to upper, a c... 阅读全文
摘要:
1. i/j – division – if both are ints, result is int, represen9ng quo9ent without remaindere.g. 3/2 = 1 3.0/2 = 1.5 but -3/2 = -22. --2 >>> 23. 'a' ... 阅读全文
摘要:
1.python 语法对 空格,缩进有严格要求2.file objects contain a special pair of built-in methods:__enter__()and__exit__() such as: with open("text.txt", "w") as v: ... 阅读全文
摘要:
1.print char 与 print char, 有很大区别 print char, 在一行输出2.enumerate functionworks by supplying a corresponding index to each element in the list that you pa... 阅读全文