上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页
摘要: We have seen built-in functions that take a variable number of arguments. For example range can take one, two or three arguments.It is possible to wri... 阅读全文
posted @ 2014-08-17 16:32 平静缓和用胸音说爱 阅读(316) 评论(0) 推荐(0) 编辑
摘要: To find the most common words, we can apply the DSU pattern; most_common takes a histogram and returns a list of word-frequency tuples, sorted in reve... 阅读全文
posted @ 2014-08-17 16:16 平静缓和用胸音说爱 阅读(211) 评论(0) 推荐(0) 编辑
摘要: Here is a program that reads a file and builds a histogram of the words in the file: process_file loops through the lines of the file, passi... 阅读全文
posted @ 2014-08-17 15:09 平静缓和用胸音说爱 阅读(225) 评论(0) 推荐(0) 编辑
摘要: Most computer programs do the same thing every time they execute, given the same inputs, so they are said to be deterministic. Deterministic is usuall... 阅读全文
posted @ 2014-08-14 16:28 平静缓和用胸音说爱 阅读(263) 评论(0) 推荐(0) 编辑
摘要: Write a program that reads a file, breaks each line into words, scripts whitespace and punctuation from the words, and converts them to lowercase. Mod... 阅读全文
posted @ 2014-08-10 21:38 平静缓和用胸音说爱 阅读(316) 评论(0) 推荐(0) 编辑
摘要: DSU stands for ‘decorate, sort, undecorate’ and refers to a pattern that is often useful for sorting lists according to some attribute of elements.For... 阅读全文
posted @ 2014-08-10 15:19 平静缓和用胸音说爱 阅读(213) 评论(0) 推荐(0) 编辑
摘要: I have focused on lists of tuples, but almost all the examples in this chapter also work with lists of lists, tuples of tuples, and tuples of lists. T... 阅读全文
posted @ 2014-07-24 20:30 平静缓和用胸音说爱 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页