摘要: Dictionaries have a method called items that returns a list of tuples, where each tuple is a key-value pair. As you should expect from a dictionary, t... 阅读全文
posted @ 2014-07-19 20:22 平静缓和用胸音说爱 阅读(182) 评论(0) 推荐(0) 编辑
摘要: zip is a built-in function that takes two or more sequence and ‘zips’ them into a list of tuples, where each tuple contains one element from each sequ... 阅读全文
posted @ 2014-07-19 17:25 平静缓和用胸音说爱 阅读(245) 评论(0) 推荐(0) 编辑
摘要: Strictly speaking, a function can only return one value, but if the value is a tuple, the effect is the same as returning multiple values. For example... 阅读全文
posted @ 2014-07-19 15:14 平静缓和用胸音说爱 阅读(280) 评论(0) 推荐(0) 编辑
摘要: It is often useful to swap the values of two variables. With conventional assignments, you have to use a temporary variable. This solution is cumberso... 阅读全文
posted @ 2014-07-19 15:04 平静缓和用胸音说爱 阅读(272) 评论(0) 推荐(0) 编辑