用Python写简历

  程序员的简历,一般通过Markdown或LaTex生成PDF,比较特别的是前端程序员会用JavaScript实现更加炫酷的网页版本简历。

  作为一个Python程序员,可以通过下面的代码,在命令行生成一份独一无二的Pythonic的简历。

  1 #/usr/bin/env python
  2 # coding=utf-8
  3 
  4 import random
  5 import re
  6 
  7 
  8 def color(messages):
  9     color = '\x1B[%d;%dm' % (1,random.randint(30,37))
 10     return '%s %s\x1B[0m' % (color,messages)
 11 
 12 
 13 def colorprint(mes, flag=True):
 14     def _deco(func):
 15         def wrapper(args):
 16             res = func(args)
 17             print (color(mes + ':\n'))
 18             if flag:
 19                 for k1, v1 in res.items():
 20                     if not isinstance(v1, dict):
 21                         print ('{0}: {1}'.format(k1, v1))
 22                     else:
 23                         print ('{0}:'.format(k1))
 24                         for k2, v2 in v1.items():
 25                             print ('    {0}: {1}'.format(k2, v2))
 26             else:
 27                 for i in res:
 28                     if not isinstance(i[1], dict):
 29                         print (i)
 30                     else:
 31                         for k, v in i[1].items():
 32                             print ('{0}[{1}]: {2}'.format(k, i[0], v))
 33             print ('\n')
 34             return res
 35         return wrapper
 36     return _deco
 37 
 38 
 39 class Resume(object):
 40 
 41     def str(self):
 42         return color('程健的python简历'.center(400))
 43 
 44     @property
 45     @colorprint('个人信息')
 46     def _personal_information(self):
 47         return {
 48             'Name' : '程健',
 49             'Gender' : 'Male',
 50             'Born' : [1987, 9, 14],
 51             'Education' : {
 52                 'School Name' : '太原科技大学',
 53                 'Major' : '电气工程及其自动化',
 54                 'Degree' : '本科',
 55                 'Graduation' : 2010
 56             },
 57             'Tel' : '181543777, four, nine',
 58             'Email' : 'newer027艾特gmail.com',
 59             'Target Positions' : re.compile(
 60                 "'Python Developer'|DevOps",re.I|re.M).pattern
 61         }
 62 
 63     @property
 64     @colorprint('个人特点')
 65     def characteristics(self):
 66         return {
 67             '心理承受能力强': '从非计算机专业-excel VBA自动化-Python开发',
 68             '热衷和喜爱': '正是因为喜欢Python, 我才会放弃采购管理',
 69             '自学能力强': '自学excel VBA和Python完成项目并满足需求',
 70             '毅力和耐性': '2013年7月,用8天时间骑车从上海回湖北老家',
 71             'is_geek' : True
 72         }
 73 
 74     @property
 75     @colorprint('个人能力')
 76     def skills(self):
 77         return {
 78             'Language' : {
 79                 '熟悉' : ['Python', 'VBA'],
 80                 '了解' : ['JavaScript', 'C']},
 81             'OS' : ['macOS', 'Ubuntu', '嵌入式Linux'],
 82             'Tool' : ['PyCharm', 'IPython', 'Git'],
 83             'Databaseandtools' : ['MongoDB', 'Redis', 'Memcached'],
 84             'WebFramework' : {
 85                 '熟悉' : ['Flask', 'Django'],
 86             },
 87             'OtherFramework' : ['Pandas', 'NumPy',
 88                                 'Celery', 'Beautiful Soup'],
 89             'Other' : 'CET-6'
 90         }
 91 
 92     @property
 93     @colorprint('工作经验', False)
 94     def work_experience(self):
 95         return enumerate([
 96             {
 97                 'Time period' : '2013.8-2017.01',
 98                 'Company Name' : '上海索广映像有限公司(SONY旗下)',
 99                 'Position' : '采购管理'
100             },
101             {
102                 'Time period' : '2010.9-2013.07',
103                 'Company Name' : '上海宏和电子材料有限公司(台湾首富王永庆之子集团旗下)',
104                 'Position' : '采购员'
105             },
106         ])
107 
108     @property
109     @colorprint('项目经验', False)
110     def projectexperience(self):
111         return enumerate([
112             {
113                 'Project' : 'VBA实现自动化数据分析/数据汇总/网页表单提交等',
114                 'Description' : ('在库存管理和采购业务推进的工作中,通过自学excel公式和VBA,'
115                                  '将各项业务采用excel VBA实现自动化.')
116             },
117             {
118                 'Project' : '雪球组合仓位分析工具',
119                 'Description' : ('后端使用Flask和Beautiful Soup,前端使用Angular和D3开发的单页面应用,'
120                                  '获取雪球ID关注的组合的调仓信息和关注组合的累计股票仓位.')
121             },
122             {
123                 'Project' : 'Django By Example逐行中文注释',
124                 'Description' : ('Django By Example全书有四个完整的Django工程项目,分别是博客网站,图片书签社交网站,'
125                                  '购物网站和在线教育网站.我在逐行手写代码,调试运行成功后,对代码给出逐行注释.')
126             },
127             {
128                 'Project' : 'Django-CMS源代码分析',
129                 'Description': ('还在进行中.作为一个大型Django项目和成熟的网站生成工具,'
130                                 'Django-CMS的源代码可以作为实施Django项目的权威参考.')
131             }
132         ])
133 
134     @property
135     @colorprint('@Where', False)
136     def findme(self):
137         return enumerate([
138             {
139                 'Link' : 'http://www.cnblogs.com/newer027',
140                 'Description' : '个人技术博客'},
141             {
142                 'Link' : 'https://github.com/newer027',
143                 'Description' : '个人GitHub主页'},
144         ])
145 
146     def show(self):
147         print(resume.str())
148         prolist = [i for i in dir(self) if not i.startswith('__')]
149         for pro in prolist:
150             getattr(self, pro)
151 
152 
153 if __name__ == '__main__':
154     resume = Resume()
155     resume.show()
View Code

  以下是在macOS Python 3.5环境中运行代码的结果。

posted on 2017-02-20 21:56  程健的博客  阅读(2162)  评论(0编辑  收藏  举报

导航