Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PythonÖ´ÐÐϵͳÃüÁîµÄ·½·¨

PythonÖÐÖ´ÐÐϵͳÃüÁî³£¼û·½·¨ÓÐÁ½ÖÖ£º
Á½Õß¾ùÐè import os
(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',  
'teststreams.py\n',  
'update_db_pickle.py\n',  
'writer.py\n']  
ºÃ´¦ÔÚÓÚ£º½«·µ»ØµÄ½á¹û¸³ÓÚÒ»±äÁ¿£¬±ãÓÚ³ÌÐòµÄ´¦Àí¡£


Ïà¹ØÎĵµ£º

Python¼òÒ×¹ÉƱ²éѯ(ץȡgoogle²Æ¾­µÄÄÚÈÝ)


¿´×ÅÍøÉÏץȡÍøÒ³Êý¾ÝµÄÎÄÕÂÖ±µÉÑÛ
ºóÀ´Ïëµ½ÓÃ×Ö·û´®·Ö¸îÀ´ÌáÈ¡ÏàÓ¦²¿·ÖµÄÄÚÈÝ
³ÌÐò¼òµ¥£¬µ«ÊýÐÐÊýºÍϱê·ÑÁ˺ܳ¤Ê±¼ä
ÎÒÖªµÀÕâ¿Ï¶¨²»ÊÇ×îºÃµÄ°ì·¨- -!!
µ«ÎÒʵÏÖÁË£¬¹þ¹þ
# -*- coding: cp936 -*-
from urllib import *
import re
def stockSearch():
    baseurl="http://www.google.cn/financ ......

Python for win

Python²Ù×÷Excel·½·¨£º
£¨1£©ÔÚsourceforge.netÉÏÓÐÒ»¸öÀ©Õ¹Ä£¿é½ÐpyXLWriter£¬¿ÉÒÔ·½±ãµÄдExcelÎļþ¡£
£¨2£©ÏÂÔØwin32com°ü×°ÉÏ,Õâ¸ö°ü¿ÉÒÔµ÷ÓÃwindowsµÄcom¼°APIº¯ÊýµÈÕâÀàµÄ¹¦ÄÜ¡£PythonÀûÓÃwin32com²Ù×÷Excel¡£
Àý×Ó£º
#!/usr/bin/env python  
# -*- coding: utf-8 -*-  
from win32com. ......

[Python and or ]Python ÖÐ and or Ö® ÎÒµÄÀí½â

c´úÂë:
int x = a>b?6,6;
ÕâÖÖÓï¾äPythonÖÐÒ²ÓУº
¿ÉÒÔͨ¹ýand or×éºÏÀ´ÊµÏÖ¡£¸öÈËÈÏΪÕâÖÖÓï¾ä¾¡Á¿ÉÙµãºÃ¡£
python°ÑÕâÀàÐ͵ŦÄÜ·¢Ñï¹âÁË´ó¡£µ«ÊÇÓÉÓÚÕâÖÖ×éºÏ±È½ÏÈÆ£¬ËùÒÔÓÐʱºò±È½Ï¾À½á:
±ÈÈç:
5 or 6 and 6  ·µ»Øwhat?
0 or 5  ·µ»Øwhat?
8 and 7  ·µ»Øwhat?
ÓÚÊÇÕûÀíÁËÏ£º
1.pyhon ÖÐÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ