python中协程的使用示例
摘要:
例子1 把字符串分割为列表def line_splitter( delimiter = None ): print( 'ready to split' ) result = None while True: line = (yield result) result = line.split( delimiter )if __name__ == '__main__': s = line_splitter(',') print( 'inital:' ) next( s ) print(... 阅读全文
posted @ 2013-10-21 16:31 鞠文广 阅读(378) 评论(0) 推荐(0) 编辑