python Ö´ÐÐϵͳÃüÁî±È½Ï
×ªÔØ×Ô£ºhttp://purpen.javaeye.com/blog/98095
python Ö´ÐÐϵͳÃüÁî±È½Ï
¹Ø¼ü×Ö: python os system ϵͳÃüÁî
Ôڴ˱ȽÏÒ»ÏÂÁ½ÖÖ·½·¨Ö´ÐÐϵͳÃüÁîµÄ·½·¨,ÒÔ·½±ãÓÚÈÕºóÔËÓÃ:(
1. os.system()
system(command) -> exit_status
Execute the command (a string) in a subshell.
# ½ö½öÔÚÒ»¸ö×ÓÖÕ¶ËÔËÐÐϵͳÃüÁî,¶ø²»ÄÜ»ñÈ¡ÃüÁîÖ´ÐкóµÄ·µ»ØÐÅÏ¢..
>>> os.system('ls') #Èç¹ûÔÙÃüÁîÐÐÏÂÖ´ÐÐ,½á¹ûÖ±½Ó´òÓ¡³öÀ´
04101419778.CHM bash document media py-django video
11.wmv books downloads Pictures python
all-20061022 Desktop Examples project tools
2.os.popen()
popen(command [, mode='r' [, bufsize]]) -> pipe
Open a pipe to/from a command returning a file object.
# ´ËÖÖ·½·¨²»µ«Ö´ÐÐÃüÁ·µ»ØÖ´ÐкóµÄÐÅÏ¢¶ÔÏó
>>>tmp = os.popen('ls *.py').readlines()
>>>tmp
Out[21]:
['dump_db_pickle.py\n',
'dump_db_pickle_recs.py\n',
'dump_db_shelve.py\n',
'initdata.py\n',
'__init__.py\n',
'make_db_pickle.py\n',
'make_db_pickle_recs.py\n',
'make_db_shelve.py\n',
'peopleinteract_query.py\n',
'reader.py\n',
'testargv.py\n',&n
Ïà¹ØÎĵµ£º
threading — Higher-level threading interface
This module constructs higher-level threading interfaces on top of the lower level _thread module. See also the queue module.
The dummy_threading module is provided for situations where threading cannot be used because _thread is missing.
......
1.³£Ó÷½·¨£¬²»´ø²ÎÊý
def decator(func):
def inner_func(*args):
args = (i * 2 for i in args)
return func(*args)
return inner_func
@decator
def add(a, ......
1.½âÊÍÐÔ ¿ÉÒÔÖ±½Ó´ÓÔ´´úÂëÔËÐгÌÐò.ÔÚ¼ÆËã»úÄÚ²¿,Python½âÊÍÆ÷°ÑÔ´´úÂëת»»³É³ÆÎª×Ö½ÚÂëµÄÖмäÐÎʽ,È»ºóÔÙ°ÑËü·Òë³É¼ÆËã»úʹÓõĻúÆ÷ÓïÑÔ²¢ÔËÐÐ.
2.#·ûºÅºóÃæµÄÄÚÈݶ¼ÊÇ×¢ÊÍ.
3.ÔÚ×Ö·û´®ÖÐÐÐÄ©µÄ'\'±íʾÏÂÒ»ÐеÄÄÚÈݺÍÉÏÒ»ÐÐÊǽÓ×ŵÄ;×Ö·û´®Ç°¼ÓÒ»¸ör±íʾijЩ²»ÐèҪתÒå·ûÄÇÑùµÄÌØ±ð´¦ÀíµÄ×Ö·û´®;ÔÚ´¦ÀíÎı¾ÎļþµÄʱºòÊ ......