Log print message into a file,logmessage,import syspr
Log print message into a file,logmessage,import syspr
import sysprint 'Dive in'saveout = sys.stdoutfsock = open('out.log', 'w')sys.stdout = fsockprint 'This message will be logged instead of displayed'sys.stdout = saveoutfsock.close()
相关内容
- Use list as a stack: push onto stack,stackonto,L = []L.appe
- Zip three tuples,zipthreetuples,T1, T2, T3 =
- in a range,inrange,from math im
- apply function,apply,def func(x,
- keeps '\' (Back splash) literally,splashliterally,x
- Specifying exception type,,# try: nu
- Use mouse to draw a shape on canvas,shapecanvas,from Tkinter
- Content tests: isalpha, isdigit, etc,isalphaisdigit,S = 'spam' S
- Use raw input to read int value,rawinput,import sys,
- Line color,linecolor,from Tkinter
评论关闭