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

pythonѧϰ

 4¡¢Tuples Ôª×é
     Ôª×éºÍListsÏàËÆ£¬µ«ËüÊÇimmutable,³õʼ»¯ºó²»ÄܸıäÆäÄÚÈÝ£¬ÕâÔÚ³ÌÐòÖÐÓÐʱºòºÜÓÐÓ㬿ÉÒÔÓÃÀ´·ÀÖ¹¶¨ÒåµÄ±äÁ¿ÄÚÈݱ»ÒâÍâ¸Ä±ä¡£
5¡¢Files Îļþ
    Îļþ²Ù×÷ºÍcÓïÑԱȽϽӽü£¬ÏÂÃæֻͨ¹ý´úÂëÑÝʾ£º
>>> f = open('data.txt','w')
>>> f.write('mike\n')
>>> f.write('wolf\n')
>>> f.close()
>>> f = open('data.txt')
>>> bytes = f.read()
>>> bytes
'mike\nwolf\n'
>>> print bytes
mike
wolf
>>> bytes.split()
['mike', 'wolf']
>>> bytes
'mike\nwolf\n'
6¡¢ÆäËûÊý¾ÝÀàÐÍ
Set(¼¯ºÏ)£¬fixed prescion floating number (¹Ì¶¨¾«¶ÈµÄ¸¡µãÊý)£¬Boolean£¨²¼¶û±äÁ¿£©£¬placehold£¨Õ¼Î»·û£©µÈ¡£
ÏÂÃæ¿´ÏÂʹÓõÄһЩ´úÂ룺
>>> x = set([1, 2, 3,4])
>>> y = set([3,4, 5,6])
>>> x|y
set([1, 2, 3, 4, 5, 6])
>>> x+y
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
x+y
TypeError: unsupported operand type(s) for +: 'set' and 'set'
>>> x,y
(set([1, 2, 3, 4]), set([3, 4, 5, 6]))
>>> x&y
set([3, 4])
>>> x-y
set([1, 2])
>>> y-x
set([5, 6])
>>> import decimal
>>> d = decimal.Decimal('4.321')
>>> d
Decimal('4.321')
>>> 1>2
False
>>> 1<2
True
>>> None
>>> L = [None]*5
>>> L
[None, None, None, None, None]
>>>
PythonÖеÄÀàÐͼì²é´úÂ룺
>>> L
[None, None, None, None, None]
>>> type(L)
<type 'list'>
>>> type(type(L))
<type 'type'>
>>> if type(L)==type([]):
print('ÀàÐÍÏàͬ')

ÀàÐÍÏàͬ
>>> if type(L)==list: #ÓÃÀàÐÍÃû×Ö
print('ok')

ok
>>> if isinstance(L,list):
print('yes')

yes
>>>
7¡¢Óû§¶¨ÒåÀà user-defined class
>>> class worker:
def __init__(self, name, pay):
self.name = name
self.pay = pay
def lastname(self):


Ïà¹ØÎĵµ£º

Python±Ê¼Ç£¨5£©

Ä£¿é
 
Ò».¼ò½é
Ä£¿é»ù±¾ÉϾÍÊÇÒ»¸ö°üº¬ÁËËùÓÐÄ㶨ÒåµÄº¯ÊýºÍ±äÁ¿µÄÎļþ¡£ÎªÁËÔÚÆäËû³ÌÐòÖÐÖØÓÃÄ£¿é£¬Ä£¿éµÄÎļþÃû±ØÐëÒÔ.pyΪÀ©Õ¹Ãû¡£
 
ÀýÈ磺
 
#!/usr/bin/python
# Filename: using_sys.py
import sys
print 'The command line arguments are:'
for i in sys.argv:
print i
print '\n ......

Python±Ê¼Ç£¨8£©

PythonµÄÃæÏò¶ÔÏóÐÔÖÊ
ÀàºÍ¶ÔÏóÊÇÃæÏò¶ÔÏó±à³ÌµÄÁ½¸öÖ÷Òª·½Ãæ¡£Àà´´½¨Ò»¸öÐÂÀàÐÍ£¬¶ø¶ÔÏóÕâ¸öÀàµÄ ʵÀý ¡£ÕâÀàËÆÓÚÄãÓÐÒ»¸öintÀàÐ͵ıäÁ¿£¬Õâ´æ´¢ÕûÊýµÄ±äÁ¿ÊÇintÀàµÄʵÀý£¨¶ÔÏ󣩡£
 
ÐèҪעÒâµÄÊÇ£¬ÔÚPythonÖУ¬¼´±ãÊÇÕûÊýÒ²±»×÷Ϊ¶ÔÏó£¨ÊôÓÚintÀࣩ¡£ÕâºÍC++¡¢Java£¨1.5°æ֮ǰ£©°ÑÕûÊý´¿´â×÷ΪÀàÐÍÊDz»Í¬µÄ¡£Í¨¹ ......

ºÜºÃµÄc++ºÍPython»ìºÏ±à³ÌÎÄÕÂ

http://www.cppblog.com/jacky2019/archive/2007/05/17/24269.html
c++ÖÐǶÈëpythonÈëÃÅ1
±¾ÈËÊÇÓÃvc2003+python2.5ѧϰµÄ£¬ÆäËüµÄÒ²Ó¦¸Ã²î²»Á˶àÉÙ
0. »µ¾³ÉèÖÃ
°ÑpythonµÄinclude/libsĿ¼·Ö±ð¼Óµ½vcµÄinclude/lib directoriesÖÐÈ¥¡£ÁíÍ⣬ÓÉÓÚpythonûÓÐÌṩdebug lib£¬ÌåµØ˵£¬¾ÍÊÇûÓÐÌṩpython25_d.libÁË¡£Äã¿É ......

pythonѧϰ

3. Dictionaries ×ÖµäÀàÐÍ
     PythonÖУ¬×ÖµäÀàÐͲ¢²»ÊÇ˳ÐòÈÝÆ÷£¬¶øÀàËÆc++ÖеĹØÁªÈÝÆ÷(map)£¬DictionariesÖд洢µÄÊǼü/Öµ ¶Ô£¬ºÍmap²»Í¬µÄÊÇ£¬PythonµÄDictionariesÖпÉÒÔ´æÈÎÒâ¶ÔÏóÀàÐÍ¡£DictionariesÀàÐÍÒ²ÊǿɱäµÄ£¬ºÍListsÒ»Ñù£¬¿ÉÒÔÔ­µØÐ޸ģ¨Í¨¹ýϱêÐ޸ģ©¡£
    ÏÂÃæͨ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ