python ÈÕÖ¾ÎÊÌâ
ÎÒÔËÐÐһϳÌÐò£º
import logging
def initlog():
logger = logging.getLogger()
hdlr = logging.FileHandler('D:\log_fram.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.NOTSET)
return logger
if __name__ == "__main__":
loger = initlog()
loger.info("Now the come return of the king!")
²åÈëÎļþûÓÐÎÊÌ⣬µ«ÊÇΪʲôµÚÒ»´ÎÔËÐвåÈëÒ»Ìõ,µÚ¶þ´Î²åÈëÁ½Ìõ£¬µÚÈý´Î²åÈëÈýÌõ£¬ÒÔ´ËÀàÍÆ£¡
²»ÖªµÀÊÇʲôÔÒòÇëÖ¸½Ì£¡
ÊÔÁËÄãµÄ½Å±¾£¬Õý³£¶î£¬Ã¿´ÎÒ»Ìõ¡£ÎҵĻ·¾³ÊÇPython 2.6.3 for Windows XP¡£
Õâ¸úÎļþ´ò¿ªËùÓÃµÄ mode Óйأ¬Ä¬ÈÏÊÇÒÔ append ´ò¿ªµÄ
Python code:
class FileHandler( filename[, mode])
Returns a new instance of the FileHandler class. The specified file is opened and used as the stream for logging. If mode is not specified, 'a' is used. By default, the file grows indefinitely.
¼¸ÖÖÎļþµÄ´ò¿ª·½Ê½£¬Ò²Ö»ÓÐaÊʺϰ¡£¬Ä¬ÈϾÍÊÇa£¬²»Ð´Ò²Ã»ÓÐʲôÎÊÌ⣡
angel_su ˵¿ÉÒÔ£¬ÄÇÊÇʲôÔÒòÄØ£¡£¿
ÎÒÓõÄÊÇpython2.5.2&
Ïà¹ØÎÊ´ð£º
ÒÑÖªPython ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ
ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
......
ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿
1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì
2.eclipseÏÂÔØjython ²å¼ ......
×î½üÒ»¸öÏîÄ¿ÂíÉϾÍÒªÓÃPython±àÁË ´ó¼ÒÍÆ¼ö¸öIDE¡£¡£¡£
1 Ãâ·Ñ¡£¡£¡£
2 Ìå»ý×îºÃСһµã
3 ¹¦ÄÜÇ¿´ó
£¨ÅÅÃû²»·ÖÏȺ󡣡£¡£·Ï»°¡£¡££©
emacs,×î´óµÄÓŵãÊÇÒòΪ·ÇͼÐνçÃæ£¬ÓÃSSHÔ¶³ÌµÇ¼Ҳ¿ÉÒÔʹÓá£ËùÒÔ¿ÉÒÔÓ ......
ѧϰPyQt£¬·¢ÏÖÆäÖÐÒ»¶Î½Å±¾ÊÇÕâÑùµÄ£º
class Form(QDialog):
........
amountLabel = QLabel("Amount")
self.amountLabel = QLabel()
........
pythonÖеÄÀàÖ ......