LinuxÏÂÓÃPYTHON²éÕÒͬÃû½ø³Ì
1.¿ÉÖ´ÐгÌÐò
os.system('pgrep %s > %s' % (process, output))
pidfile = open("output", 'r')
totalpid = len(pidfile.readlines())
pidfile.close()
if totalpid == 0 :
#ûÓнø³Ì
return False
elif totalpid > 1 :
#¶à¸ö½ø³Ì
os.system('killall -9 %s' % (process))
return False
else :
return True
2.python Æô¶¯µÄ½Å±¾
os.system('ps aux | grep %s > %s' % (process, output))
&nbs
Ïà¹ØÎĵµ£º
Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......
ÀµÓºƣ¨http://laiyonghao.com£©
½ñÌ죨2009Äê5ÔÂ31ÈÕ£© OurPNP.org ¸ãÁ˸ö¾Û»á»î¶¯£¬ÅªÁËÊ®¼¸¶þÊ®¸öÈËÔÚ¹ãÖݺ£Öé¹ã³¡µÄÌûá´ôÁËÎå¸öСʱ£¬´´ÏÂÁËÎÒÔÚ K ·¿´ôµÄ×ʱ¼ä¼Í¼¡£Ó¦ËûÃǵÄÑûÇ룬ÎÒ×öÁ˸öÌâΪ¡¶Óà python ¿ìËٴÍøÓηþÎñÆ÷¡·µÄСÑݽ²£¬ÒòΪÄDZߵĵçÊÓ¾¹È»²»ÄܽӵçÄÔ£¬ËùÒÔ½²µÄʱºòûÓÐÄܹ»²ÎÕÕ PPT À´½²£¬¹Û ......
linuxµÄÃüÁîÏê½â
cat cd
chmod chown
cp cut
Ãû³Æ£ºcat
ʹÓÃȨÏÞ£ºËùÓÐʹÓÃÕß
ʹÓ÷½Ê½£ºcat [-abeensttuv] [--help] [--version] filename
˵Ã÷£º°Ñµµ°¸´®Á¬½Óºó´«µ½»ù±¾Êä³ö£¨Ó©Ä»»ò¼Ó > filename µ½ÁíÒ»¸öµµ°¸£©  ......
ÕâƪÎÄÕ»ù±¾ÉϽ²Ã÷°×ÁËÈçºÎ°²×°LinuxÏ嵀 vmtools£¬²»¹ýÎÒºÍËûµÄ°²×°²»Í¬£¬ËùÒÔ½ö¹©²Î¿¼£¬¾ßÌåʵÏÖÒª¿´ÊÇÄÇÖÖLinuxϵͳ£¬»òÕßÊǾßÌåµÄÄǸö°æ±¾£¬ÎÒÓÃredhatºÍubuntu¡£»ù±¾²Ù×÷¾ÍÊÇ£º
¹ÒÔعâÇý¡¢¸´ÖÆÎļþµ½tmp¡¢½âѹ¡¢°²×°¡¢Ò»Â·Ä¬ÈÏ¡¢°²×°Íê³É¡£
1¡¢ÒÔROOTÉí·Ý½øÈëLINUX
2¡¢°´Ï CTRL+ALT×éºÏ¼ü£¬½øÈëÖ÷²Ù×÷ϵͳ£ ......
linuxÃüÁîÐÐÏÂÖÐÎÄÎļþÃûÂÒÂëµÄ½â¾ö·½·¨
Ê×ÏȲéѯ֧³ÖµÄ±àÂë:
locale -a
Èç¹ûûÓÐÄãÐèÒªµÄ±àÂ룬ÀýÈçzh_CN.utf8
rootÔËÐÐ: #dpkg-reconfigure locales
Ñ¡ÔñÄãÐèÒªµÄ±àÂ룬ÓÿոñÑ¡ÖУ¬¿É¶àÑ¡¡£tabÑ¡Ôñ“OK”£¬»Ø³µ¡£
ĬÈϱàÂëÑ¡Ôñzh_CN.utf8
°²×°ÄãËùÐèÒªµÄ±àÂë¡£
ÐÞ¸Ä/etc/profile,
×¢Ê͵ô
export LC ......