发布时间:2012-12-27 10:21:26
六、向数组中添加内容append shoplist = ['apple', 'mango', 'carrot', 'banana'] print 'I have', len(shoplist),'items to purchase.' print 'These items are:', # Notice the comma at end of the line for item in shoplist: # 遍历数组使用的是 for item in shoplist &nb......【阅读全文】
发布时间:2012-12-27 09:22:21
一、python中的List: Example 3.25. key s, values 和 i tems 函数 >>> params = {"server":"mpilgrim", "database":"master", "uid":"sa", "pwd":"secret"} >>> params.keys() (1) ['server', 'uid', 'database', 'pwd'] >>> params.......【阅读全文】
发布时间:2012-12-27 09:17:17
单引号和双引号: 在双引号中的字符串与单引号中的字符串的使用完全相同使用三引号('''或"""): 利用三引号,你可以指示一个多行的字符串。你可以在三引号中自由的使用单引号和双引号。 例如: '''This is a multi-line string. This is the first line. This is the second line. "What's your name?," I asked. He said "Bond, James Bond." '''转义符: 'What\'s you name' (注意要加上\来转义'不然python会不认识')级......【阅读全文】