随笔分类 -  Python

摘要:```cpp #dictionary可以保存不同类型的值 menu = {'fish0':14.50} list = [] menu['fish1'] = 10.1 # Adding new key-value pair menu['fish2'] = 12.01 menu[12] = list list.append(123) #list中也可以保存不同类型的值 list.append(... 阅读全文
posted @ 2016-01-12 15:30 阿文的博客 阅读(204) 评论(0) 推荐(0)
摘要:```cpp animals = ["aardvark", "badger", "duck", "emu", "fennec fox"] print(animals[1:3]) # print "badger" and "duck" duck_index = animals.index("duck") # Use index() to find "duck" animals.in... 阅读全文
posted @ 2016-01-11 22:17 阿文的博客 阅读(136) 评论(0) 推荐(0)
摘要:```cpp # str = "AbCd" #以下示例均使用该字符串 截取: print(str[1:3]) #输出"bC" 转小写: print(str.lower()) #输出"abcd" 转大写: print(str.upper()) #输出"ABCD" 长度: print(len(str)) #输出4 选择满足某些条件的值 1> ... 阅读全文
posted @ 2016-01-11 21:57 阿文的博客 阅读(143) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/Bonker/p/3584707.html 阅读全文
posted @ 2016-01-09 12:23 阿文的博客 阅读(159) 评论(0) 推荐(0)
摘要:```cpp string_1 = "Camelot" string_2 = "place" print("float:%lf. int:%d string:%s." % (3.14,123, string_2)) print("I am a {type}".format(type=11.1)) my_name = "Michael" print("Hello, my name is {nam... 阅读全文
posted @ 2016-01-09 10:04 阿文的博客 阅读(686) 评论(0) 推荐(0)