PythonÖÐÖ´ÐÐshellÃüÁîµÄʵÀý
1¡£
myCoolVariable="some_string"
os.system("echo myCoolVariable")
2.
>>> os.system('echo "asdg"')
asdg
0
>>> os.system("echo 'asdgwere'")
asdgwere
0
3.
$ python
>>>hamburger="potato"
>>>import os
>>>os.system("echo 'hamburger'")
potato
0
4.
hamburger=os.system('echo $MY_SHELL_VAR | sed "s/longsed/replacement/g"')
5.
>>> string="python is cool"
>>> cmd="echo "+string
>>> os.system(cmd)
python is cool
0
>>>
6.
bash$ python
Python 2.4.3 (#1, May 18 2006, 07:40:45)
[GCC 3.3.3 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from os import system
>>> food = 'spam'
>>> system('echo %(food)s' % locals())
spam
0
>>>
Ïà¹ØÎĵµ£º
int main()
{
int a[] = {1,2,3,4,5};
int i;
int * p = a;
for (p = a + 4, i = 0; i < 5; i++) {
printf("%d ",p[-i]);
}
return 0;
}
......
twistedÊÇÒ»¸öרÃÅÓÃÓÚpythonµÄÍøÂ翪·¢µÄ¿ò¼Ü¡£¿ÉÒÔ˵ÊÇÏÖÔÚpythonÖÐеÄÒ»Ö§ÖÁÁ¦ÓÚ·¢Õ¹¸ßÐÔÄÜÍøÂ翪·¢µÄ¿ò¼Ü£¬·¢Õ¹ºÜÎȶ¨¡£
http://twistedmatrix.com/trac/
http://www-128.ibm.com/developerworks/cn/linux/network/l-twist/part1/index.html
http://wiki.woodpecker.org.cn/moin/PyTwisted ......
Ò»¡¢Ê²Ã´ÊÇPython£¿
¶ÔÓÚÕâÖÖÎÊÌâÎÒÃÇÀ´°Ù¶ÈһϾͿÉÒÔÁË¡£
“PythonÊÇÒ»ÖÖ¿ª·ÅÔ´´úÂëµÄ½Å±¾±à³ÌÓïÑÔ£¬ÕâÖֽű¾ÓïÑÔÌرðÇ¿µ÷¿ª·¢ËٶȺʹúÂëµÄÇåÎú³Ì¶È¡£Ëü¿ÉÒÔÓÃÀ´¿ª·¢¸÷ÖÖ³ÌÐò£¬´Ó¼òµ¥µÄ½Å±¾ÈÎÎñµ½¸´Ôӵġ¢ÃæÏò¶ÔÏóµÄÓ¦ÓóÌÐò¶¼ÓдóÏÔÉíÊֵĵط½¡£Python»¹±»µ±×÷Ò»ÖÖÈëÃųÌÐòÔ±×îÊʺÏÕÆÎÕµÄÓÅÐãÓïÑÔ£¬ÒòΪËüÃâ·Ñ¡¢Ã ......
pythonÖÐÀàµÄÊôÐÔ
pythonÖеÄÀà½Ðclass object,ÀàµÄʵÀý½Ðinstance object.
Àà Class Objects
ÀàÓµÓÐÁ½ÖÖ²Ù×÷,1.ÀàÊôÐÔ attribute references 2.ʵÀý»¯instantiation
1.ÀàÊôÐÔ¾ÍÏ൱ÓÚרÊôÓÚÒ»¸öÀàµÄ±äÁ¿(¼´Ä³Ð©ÓïÑÔÖеÄÀàµÄ¾²Ì¬¹«¹²±äÁ¿static public),ʹÓ÷½·¨ÊÇ:ÀàÃû³Æ.ÀàÊôÐÔÃû³Æ
2.ʵÀý»¯ÔòÊÇ´´½¨Ò»¸öÀàµÄʵÀýµÄ· ......