第4月第20天 python re xls2lua

1.

import re


replace_values = ['one', 'two', 'three']
replace_keys = [str(i) for i in xrange(1, 4)]
replace_dict = dict(zip(replace_keys, replace_values))

def replace(match):
    return replace_dict[match.group(0)]


string = '1 adfa fa 2 fafsa 3 adfaf'
print re.sub(r'(^|\b)[1-3]($|\b)', replace, string)

作者:孙竟
链接:https://www.zhihu.com/question/36596275/answer/68175650
来源:知乎
著作权归作者所有,转载请联系作者获得授权。

https://www.zhihu.com/question/36596275

 

2.

 

https://github.com/luzexi/xls2lua

https://github.com/wangshunping/Starup-Game-Python

https://www.zhihu.com/question/20263645

posted @ 2017-01-20 15:00  lianhuaren  阅读(203)  评论(0编辑  收藏  举报