上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页
摘要: 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) 编辑
摘要: A tuple is a sequence of values. The values can be any type, and they are indexed by integers, so in that respect tuples are a lot like lists. The imp... 阅读全文
posted @ 2014-07-15 19:59 平静缓和用胸音说爱 阅读(202) 评论(0) 推荐(0) 编辑
摘要: If you played with the Fibonacci function, you might have noticed that the bigger the argument you provide, the longer the function takes to run. Furt... 阅读全文
posted @ 2014-07-15 19:08 平静缓和用胸音说爱 阅读(226) 评论(0) 推荐(0) 编辑
摘要: Lists can appear as values in a dictionary. For example, if you were given a dictionary that maps from letters to frequencies, you might want to inver... 阅读全文
posted @ 2014-07-15 17:19 平静缓和用胸音说爱 阅读(209) 评论(0) 推荐(0) 编辑
摘要: If you use a dictionary in a for statement, it traverses the keys of the dictionary. For example, print_hist prints each key and the corresponding val... 阅读全文
posted @ 2014-07-15 13:40 平静缓和用胸音说爱 阅读(238) 评论(0) 推荐(0) 编辑
摘要: Suppose you are given a string and you want to count how many times each letters appears. There are several ways you do it:You could create 26 variabl... 阅读全文
posted @ 2014-07-14 12:56 平静缓和用胸音说爱 阅读(228) 评论(0) 推荐(0) 编辑
摘要: A dictionary is like a list, but more general. In a list, the indices have to be integers; in a dictionary they can be (almost) any type. You can thin... 阅读全文
posted @ 2014-07-14 11:13 平静缓和用胸音说爱 阅读(412) 评论(0) 推荐(0) 编辑
摘要: The slice operator can take a third argument that determines the step size, so t[::2] creates a list that contains every other element from t. If the ... 阅读全文
posted @ 2014-07-13 19:55 平静缓和用胸音说爱 阅读(193) 评论(0) 推荐(0) 编辑
摘要: A string is a sequence of characters and a list is a sequence of values, but a list of characters is not the same as a string. To convert from a strin... 阅读全文
posted @ 2014-07-13 19:20 平静缓和用胸音说爱 阅读(218) 评论(0) 推荐(0) 编辑
摘要: When you assign an object to a variable, Python copies the reference to the object. In this case a and b refer to the same list.If you want ... 阅读全文
posted @ 2014-07-13 18:59 平静缓和用胸音说爱 阅读(172) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页