随笔分类 - Python3
摘要:1、运行时加-u参数,如 # python3 -u test.py >> test.log &用man查看python的-u参数,说明如下: Force stdin, stdout and stderr to be totally unbuffered. On systems where it ma
阅读全文
摘要:>>> word = "Python" >>> word[:2] # character from the beginning to position 2 (excluded)'Py'>>> word[4:] # characters from position 4 (included) to th
阅读全文
摘要:import threading def write_dbs(i): print(i)if __name__ == '__main__': for i in range(7): t = threading.Thread(target=write_dbs, args=(i,)) t.start()
阅读全文
摘要:import threadingimport timeimport datetimedef exec_update(): time.sleep(5)def event_func(): now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%
阅读全文