摘要: ``` coding=utf 8 输入 print'100+200=',100+200 输入 name = raw_input('tell me your name:') print'hello',name,'!' 整数 print(0xff00) 字符串 同时出现单双引号,用转义字符\标识。r'' 阅读全文
posted @ 2017-11-16 21:28 SingSingaSong 阅读(165) 评论(0) 推荐(0)
摘要: ``` coding= utf 8 条件判断和循环 如果if语句判断是True,就把缩进的两行print语句执行了,否则,什么也不做 age1 = 20 if age1 = 18: print 'adult'; num = 10; if num 100: print num, "大于100" els 阅读全文
posted @ 2017-11-16 21:27 SingSingaSong 阅读(180) 评论(0) 推荐(0)
摘要: ``` # coding=utf-8 # list有序集合 classmate = ['Michael', 'Bob', 'Tracy'] print classmate print len(classmate) print classmate[0] print '倒数第一:',classmate[-1] # 直接获得最后一个元素 print '倒数第二个人:',classmate[-2]... 阅读全文
posted @ 2017-11-16 21:27 SingSingaSong 阅读(455) 评论(0) 推荐(0)
摘要: ``` #coding=utf-8 # dict dict= {'bob': 40, 'andy': 30} print dict['bob'] # 通过dict提供的get方法,如果key不存在,可以返回None,或者自己指定的value: print dict.get('Lisa',666) # 要删除一个key,用pop(key)方法,对应的value也会从dict中删除: dict.po... 阅读全文
posted @ 2017-11-16 21:24 SingSingaSong 阅读(125) 评论(0) 推荐(0)