如下的资料是关于python从任意文件读取邮件地址输出的代码. # This script takes whatever you throw at stdin and outputs email addresses.# eg. python email_extractor.py < PythonFAQ.html# This script can be used for whatever you want, EXCEPT SPAMMING !import sys,reprint 'n'.join(
碰到的问题,一段代码,print在前,log的在后,查看日志中log的反而在前面.是python输出缓冲区的问题. python输出缓冲区要满 4k 才写入文件,除非禁用缓存或者强制输出或者程序结束.中途 ctrl+c 中断会丢失一些输出. #!/usr/bin/python #coding=utf-8 ''' 暂停1s输出 ''' import time def printStar(n): for i in range(n): print " * ", time.sleep(1) i