python
文章平均质量分 51
u010157717
这个作者很懒,什么都没留下…
展开
-
正则表达式匹配连续重复单词Regular Expression For Consecutive Duplicate Unicode Words
Regular Expression For Consecutive Duplicate Unicode Words原创 2016-05-11 14:44:35 · 3763 阅读 · 0 评论 -
Python NLP相关工具
NLTKNLP POS Tagging与NERNLP Stemming与Lemmatization的区别nltk.tokenize.word_tokenize(s)Numpynp.zeros((D, N))np.random.shuffle(data)pandasdata = pd.read_csv('spambase.data').as_matri原创 2016-06-15 05:25:20 · 624 阅读 · 0 评论 -
Python2 Unicode
#1 英文str与unicode 内容相同 但是类型不同 test_type#2 中文str与unicode 内容与类型都不同test_type#3 open只能按照str读test_open_str_filetest_open_unicode_file#4 codecs只能按照unicode读test_codecs_str_filetest_codecs_unicode_fi原创 2016-08-11 15:29:18 · 550 阅读 · 0 评论 -
Python multiprocessing需要避免的陷阱
这段代码可以在Mac上正常运行(windows不行)# build.pyfrom multiprocessing import Poolimport tracebackdef f(x): print 'start pool.f' return x*xdef run(): for line in traceback.format_stack():原创 2016-10-25 14:02:23 · 3467 阅读 · 0 评论 -
Python
#1 load dictionary from file# .$ .'' .-LRB- .-RRB- ., .. .: .ADD XAFX PRTCC CONJCD NUMDT DETEX DETFW XGW XHYPH .IN ADPJJ ADJJJR ADJJJS ADJLS XMD VERBNFP原创 2016-07-19 05:46:51 · 375 阅读 · 0 评论 -
Python SOAP API, HTTP POST and HTTP GET
#0 print_utils.pydef print_decorator(argument): def real_decorator(function): def wrapper(*args, **kwargs): print '-' * 10 + 'start of ' + argument + '-' * 10 fun原创 2016-10-28 09:09:04 · 3038 阅读 · 0 评论 -
Python Context Manager
https://jeffknupp.com/blog/2016/03/07/python-with-context-managers/转载 2016-10-06 07:42:32 · 305 阅读 · 0 评论 -
Python print线程安全
import threadingimport loggingimport subprocesslock = threading.Lock()STR = "abc abc abc"# print is not thread safedef printer(): while True: print STR# lock printdef lock_pr原创 2016-10-06 07:48:04 · 1500 阅读 · 0 评论