gentooÐ¶ÔØPythonµ¼ÖÂemerge²»ÄÜʹÓýâ¾ö·½·¨
½ñÌìÒ»²»Ð¡ÐİÑPython¸øÐ¶ÔصôÁË£¬µ¼ÖÂemerge²»ÄÜʹÓã¬×îÖÕÕÒµ½ÈçϽâ¾ö·½°¸£º
wget http://www.python.org/ftp/python/2.4.4/Python-2.4.4.tar.bz2\
tar xjvf Python-2.4.4.tar.bz
cd Python-2.4.4
./configure –with-fpectl –infodir=/usr/share/info/ –mandir=/usr/share/man
make
make install prefix=/usr
rm /usr/bin/python 2>/dev/null
ln -s /usr/bin/python2.4 /usr/bin/python2
ln -s /usr/bin/python2 /usr/bin/python
È»ºóÔÚemerge -av python
,½«Python¸üоÍokÁË¡£
Ïà¹ØÎĵµ£º
client:
import socket, sys
if __name__ == '__main__':
#´¦Àí²ÎÊý
argv = sys.argv
if (len(argv)!=3) or (len(argv)==2 and argv[1]=='/?'):
print '>>>Useage:', argv[0], '<address> < ......
import sys
import os
import datetime
import time
class ArgsDealwith:
def arg_environment(self, args):
filepath = ('PYTHON_PATH', 'path')
for i in filepath:
&nbs ......
PythonµÄÃæÏò¶ÔÏóÐÔÖÊ
ÀàºÍ¶ÔÏóÊÇÃæÏò¶ÔÏó±à³ÌµÄÁ½¸öÖ÷Òª·½Ãæ¡£Àà´´½¨Ò»¸öÐÂÀàÐÍ£¬¶ø¶ÔÏóÕâ¸öÀàµÄ ʵÀý ¡£ÕâÀàËÆÓÚÄãÓÐÒ»¸öintÀàÐ͵ıäÁ¿£¬Õâ´æ´¢ÕûÊýµÄ±äÁ¿ÊÇintÀàµÄʵÀý£¨¶ÔÏ󣩡£
ÐèҪעÒâµÄÊÇ£¬ÔÚPythonÖУ¬¼´±ãÊÇÕûÊýÒ²±»×÷Ϊ¶ÔÏó£¨ÊôÓÚintÀࣩ¡£ÕâºÍC++¡¢Java£¨1.5°æÖ®Ç°£©°ÑÕûÊý´¿´â×÷ΪÀàÐÍÊDz»Í¬µÄ¡£Í¨¹ ......
ÔÚPythonÖÐÓÐÐ©ÌØÊâµÄµØ·½ÊÇ´æÔÚÁ½ÖÖ×Ö·û´®£¬·Ö±ðΪstrºÍunicode×Ö·û´®£¬ËûÃǶ¼¼Ì³Ð×Ôbasestring¡£
È磺s="hello world"£¬sΪstr£»us=u"hello world"£¬usΪunicode¡£
ʹÓÃhelp(str)ºÍhelp(unicode)¿ÉÒԲ鿴¸÷×Ô˵Ã÷£¬ËûÃǶ¼ÓÐdecode¡¢encode·½·¨£¬
decodeÓÃÓÚ½«str×Ö·û´®½âÂëΪunicode×Ö·û´®£¬
encodeÓÃÓÚ½«unicode×Ö·û ......