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

Python×Ö·û´®²Ù×÷

 #Python×Ö·û´®²Ù×÷
''
'1.¸´ÖÆ×Ö·û´®'
''
#strcpy(
sStr1,
sStr2)
sStr1 =
'strcpy'
sStr2 =
sStr1
sStr1 =
'strcpy2'
print
sStr2
''
'2.Á¬½Ó×Ö·û´®'
''
#strcat(
sStr1,
sStr2)
sStr1 =
'strcat'
sStr2 =
'append'
sStr1 +
=
sStr2
print
sStr1
''
'3.²éÕÒ×Ö·û'
''
#strchr(
sStr1,
sStr2)
sStr1 =
'strchr'
sStr2 =
'r'
nPos =
sStr1.
index(
sStr2)
print
nPos
''
'4.±È½Ï×Ö·û´®'
''
#strcmp(
sStr1,
sStr2)
sStr1 =
'strchr'
sStr2 =
'strch'
print
cmp(
sStr1,
sStr2)
''
'5.ɨÃè×Ö·û´®ÊÇ·ñ°üº¬Ö¸¶¨µÄ×Ö·û'
''
#strspn(
sStr1,
sStr2)
sStr1 =
'12345678'
sStr2 =
'456'
#sStr1 and
chars both in
sStr1 and
sStr2
print
len(
sStr1 and
sStr2)
''
'6.×Ö·û´®³¤¶È'
''
#strlen(
sStr1)
sStr1 =
'strlen'
print
len(
sStr1)
''
'7.½«×Ö·û´®ÖеÄСд×Ö·ûת»»Îª´óд×Ö·û'
''
#strlwr(
sStr1)
sStr1 =
'JCstrlwr'
sStr1 =
sStr1.
upper(
)
print
sStr1
''
'8.×·¼ÓÖ¸¶¨³¤¶ÈµÄ×Ö·û´®'
''
#strncat(
sStr1,
sStr2,
n)
sStr1 =
'12345'
sStr2 =
'abcdef'
n =
3
sStr1 +
=
sStr2[
0:
n]
print
sStr1
''
'9.×Ö·û´®Ö¸¶¨³¤¶È±È½Ï'
''
#strncmp(
sStr1,
sStr2,
n)
sStr1 =
'12345'
sStr2 =
'123bc'
n =
3
print
cmp(
sStr1[
0:
n]
,
sStr2[
0:
n]
)
''
'10.¸´ÖÆÖ¸¶¨³¤¶ÈµÄ×Ö·û'
''
#strncpy(
sStr1,
sStr2,
n)
sStr1 =
''
sStr2 =
'12345'
n =
3
sStr1 =
sStr2[
0:
n]
print
sStr1
''
'11.×Ö·û´®±È½Ï£¬²»Çø·Ö´óСд'
''
#stricmp(
sStr1,
sStr2)
sStr1 =
'abcefg'
sStr2 =
'ABCEFG'
print
cmp(
sStr1.
upper(
)
,
sStr2.
upper(
)
)
''
'12.½«×Ö·û´®Ç°n¸ö×Ö·ûÌæ»»ÎªÖ¸¶¨µÄ×Ö·û'
''
#strnset(
sStr1,
ch,
n)
sStr1 =
'12345'
ch =
'r'
n =
3
sStr1 =
n *
ch +
sStr1[
3:
]
print
sStr1
''
'13.ɨÃè×Ö·û´®'
''
#strpbrk(
sStr1,
sStr2)
sStr1 =
'cekjgdklab'
sStr2 =
'gka'
nPos =
-
1
for
c in
sStr1:
    if
c in
sStr2:
        nPos =
sStr1.
index(
c)
    


Ïà¹ØÎĵµ£º

Python Ï̳߳Ø


import Queue, threading, sys
from threading import Thread
import time,urllib
# working thread
class Worker(Thread):
   worker_count = 0
   def __init__( self, workQueue, resultQueue, timeout = 0, **kwds):
       Thread.__init__( self, **kwds ) ......

Python¼àÊÓ½ø³Ì


ÓÉsubprocess´´½¨Ò»¸ö½ø³Ì£¬È»ºó½øÐмàÊÓ
ÿһÃëÖӲ鿴һ´Î£¬Èç¹ûÕýÔÚÔËÐУ¬´òÓ¡pidºÍrunning£¬Èç¹ûÒÑÍ£Ö¹£¬,¼ÌÐøÖ´ÐÐÈÎÎñ²¢´òÓ¡Termined
shellºÍstdout¾ùÉèÖÃΪFalse
Ò²ÐíÕâ¶Ô×ö²¡¶¾µÄÊØ»¤½ø³ÌºÜºÃ
#!/usr/bin/env python
import subprocess , sys , time
p=subprocess.Popen(['ping','127.0.0.1','-n','10'], she ......

Eclipse+PyDev = Python±à¼­Æ÷£¬

http://www.ibm.com/developerworks/cn/opensource/os-cn-ecl-pydev/Á¬½ÓÕâ¸öÍøÖ·£¬²»»áÈÃÄãʧÍûµÄ¡£
PyDev ¼ò½é
2003Äê7ÔÂ16ÈÕ£¬ÒÔ Fabio Zadrozny ΪÊ×µÄÈýÈË¿ª·¢Ð¡×éÔÚÈ«Çò×î´óµÄ¿ª·ÅÔ´´úÂëÈí¼þ¿ª·¢Æ½Ì¨ºÍ²Ö¿â SourceForge ÉÏ×¢²áÁËÒ»¿îеÄÏîÄ¿£¬¸ÃÏîĿʵÏÖÁËÒ»¸ö¹¦ÄÜÇ¿´óµÄ Eclipse²å¼þ£¬Óû§¿ÉÒÔÍêÈ«ÀûÓà Eclipse À ......

python ¶íÂÞ˹·½¿é

Õâ¸öËãÊÇC++ǶÈëpython°É£¬ÀûÓÃpythonʵÏÖÏÔʾºÍʼþ´¦Àí£¬C++ʵÏÖÂß¼­
ÒÔºóÓÐʱ¼äÒ²»á·´¹ýÀ´ÊÔÊÔ£º£© 
import pygame
import sys
import os
import ctypes
def cur_file_dir():
#»ñÈ¡½Å±¾Â·¾¶
path = sys.path[0]
#ÅжÏΪ½Å±¾Îļþ»¹ÊÇpy2exe±àÒëºóµÄÎļþ£¬Èç¹ûÊǽű¾Îļþ£¬Ôò·µ»ØµÄÊǽű¾µÄĿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ