摘要: OOP: Structure, Encapsulation, Customization1. Using Classesclass Person: def __init__(self, name, age, pay=0, job=None): self.name=name ... 阅读全文
posted @ 2014-02-22 15:51 yjjsdu 阅读(178) 评论(0) 推荐(0)
摘要: 1. Using formatted files#test scriptbob={'name': 'bob smith', 'age': 42, 'pay':30000, 'job':'dev'}sue={'name': 'sue jones', 'age':45,'pay':40000,'job'... 阅读全文
posted @ 2014-02-22 14:41 yjjsdu 阅读(374) 评论(0) 推荐(0)
摘要: 1. using listbob=['bob smith', 42, 3000, 'software']sue=['sue jones', 45, 4000, 'hardware']bob[0], sue[2]bob[0].split()[-1]split 默认以空格分隔sue[2]*=1.25p... 阅读全文
posted @ 2014-02-22 10:58 yjjsdu 阅读(236) 评论(0) 推荐(0)