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

pythonÖÐ%·ûºÅÏê½â

%a ÐÇÆÚ¼¸µÄ¼òд
%A ÐÇÆÚ¼¸µÄÈ«³Æ
%b Ô·ֵļòд
%B Ô·ݵÄÈ«³Æ
%c ±ê×¼µÄÈÕÆÚµÄʱ¼ä´®
%C
Äê·ÝµÄºóÁ½Î»Êý×Ö
%d Ê®½øÖƱíʾµÄÿÔµĵڼ¸Ìì
%D ÔÂ/Ìì/Äê
%e ÔÚÁ½×Ö·ûÓòÖУ¬Ê®½øÖƱíʾµÄÿÔµĵڼ¸Ìì
%F
Äê-ÔÂ-ÈÕ
%g Äê·ÝµÄºóÁ½Î»Êý×Ö£¬Ê¹ÓûùÓÚÖܵÄÄê
%G Äê·Ö£¬Ê¹ÓûùÓÚÖܵÄÄê
%h ¼òдµÄÔ·ÝÃû
%H
24СʱÖƵÄСʱ
%I 12СʱÖƵÄСʱ
%j Ê®½øÖƱíʾµÄÿÄêµÄµÚ¼¸Ìì
%m Ê®½øÖƱíʾµÄÔ·Ý
%M
ʮʱÖƱíʾµÄ·ÖÖÓÊý
%n ÐÂÐзû
%p ±¾µØµÄAM»òPMµÄµÈ¼ÛÏÔʾ
%r 12СʱµÄʱ¼ä
%R
ÏÔʾСʱºÍ·ÖÖÓ£ºhh:mm
%S Ê®½øÖƵÄÃëÊý
%t ˮƽÖƱí·û
%T ÏÔʾʱ·ÖÃ룺hh:mm:ss
%u
ÿÖܵĵڼ¸Ì죬ÐÇÆÚһΪµÚÒ»Ìì £¨Öµ´Ó0µ½6£¬ÐÇÆÚһΪ0£©
%U µÚÄêµÄµÚ¼¸ÖÜ£¬°ÑÐÇÆÚÈÕ×öΪµÚÒ»Ì죨ֵ´Ó0µ½53£©
%V
ÿÄêµÄµÚ¼¸ÖÜ£¬Ê¹ÓûùÓÚÖܵÄÄê
%w Ê®½øÖƱíʾµÄÐÇÆÚ¼¸£¨Öµ´Ó0µ½6£¬ÐÇÆÚÌìΪ0£©
%W
ÿÄêµÄµÚ¼¸ÖÜ£¬°ÑÐÇÆÚÒ»×öΪµÚÒ»Ì죨ֵ´Ó0µ½53£©
%x ±ê×¼µÄÈÕÆÚ´®
%X ±ê×¼µÄʱ¼ä´®
%y
²»´øÊÀ¼ÍµÄÊ®½øÖÆÄê·Ý£¨Öµ´Ó0µ½99£©
%Y ´øÊÀ¼Í²¿·ÖµÄÊ®ÖÆÄê·Ý
%z£¬%Z ʱÇøÃû³Æ£¬Èç¹û²»Äܵõ½Ê±ÇøÃû³ÆÔò·µ»Ø¿Õ×Ö·û¡£
%%
°Ù·ÖºÅ


Ïà¹ØÎĵµ£º

python¶ÁдÎļþ


1.open
ʹÓÃopen´ò¿ªÎļþºóÒ»¶¨Òª¼ÇµÃµ÷ÓÃÎļþ¶ÔÏóµÄclose()·½·¨¡£±ÈÈç¿ÉÒÔÓÃtry/finallyÓï¾äÀ´È·±£×îºóÄܹرÕÎļþ¡£
file_object = open('thefile.txt')
try:
     all_the_text = file_object.read( )
finally:
     file_object.close( )
×¢£º²»Ä ......

ʹÓÃPython¶ÁSEGYµÀÍ·

×Ô¼ºÓöµ½µÄÒ»¸öÎÊÌâ, WestGecoµÄ3DµØÕðÊý¾Ý, ÌáÈ¡µ¼º½Êý¾Ý:
#!/bin/env python
import sys
import struct
try:
        f=open(sys.argv[1],'rb')
except (IOError,Exception):
    print '''usage:
        scriptname segyfilename
'''
&nbs ......

python »ñÈ¡±¾»úip

>>> from socket import socket, SOCK_DGRAM, AF_INET
>>> s = socket(AF_INET, SOCK_DGRAM)
>>> s.connect(('google.com', 0))
>>> s.getsockname()
('192.168.1.113', 43711) 
Linux:
import socket
import fcntl
import struct
def get_ip_address(ifname):
s = ......

PythonÕýÔò±í´ïʽ

ÕýÔò±í´ïʽÊǸöħ¹í£¬Ò²ÊǸöÌìʹ¡£ÔÚÄãûÓÐÕÆÎÕËü֮ǰ£¬ËüÊÇħ¹í£¬ÔÚÄãÕÆÎÕËüºó£¬ËüÊÇÌìʹ£¬µ«ÊÇ£¬Ê±
²»Ê±»¹ÊÇÒªÌø³öÀ´£¬¸øÄãµ÷Ƥµ·µ°Ò»·¬¡£


Ò»¸öÕýÔò±í´ïʽ¾ÍÊÇÓÉÆÕͨ×Ö·ûÒÔ¼°ÌØÊâ×Ö·û×é³ÉµÄÎÄ×Öģʽ£¬¸ÃģʽÃèÊöÔÚ²éÕÒÎÄ×ÖÖ÷Ìåʱ´ý
Æ¥ÅäµÄÒ»¸ö»ò¶à¸ö×Ö·û´®¡£ÕýÔò±í´ïʽ×÷Ϊһ¸öÄ£°å£¬½«Ä³¸ö×Ö·ûģʽÓëËùËÑË÷µÄ ......

python´¦ÀíXML

»ù±¾É϶¼ÊÇʹÓÃpythonÀ´½âÎöxmlÎļþµÄ¡£
±ÈÈçÎÒÒª½«ÄÚÈÝΪ
<?xml version="1.0" encoding="utf-8"?>
    <root>
        <book isbn="34909023">
            <author>
 &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ