python »ù±¾ÀàÐÍlist¡¢tuple¡¢dictѧϰ
1.list£¨Êý×飩
x´ú±íÊý×éÖеÄÔªËØ£¬i´ú±íλÖÃ
a) append(x) °ÑÔªËØxÌí¼Óµ½Êý×éµÄβ²¿
b) insert(i,x) °ÑÔªËØx ²åÈ뵽λÖÃi
c) remove(x) ɾ³ýµÚÒ»¸öÔªËØx
d) pop(i) ɾ³ýµÚi¸öÔªËØ£¬²¢·µ»ØÕâ¸öÔªËØ¡£Èôµ÷ÓÃpop()Ôòɾ³ý×îºóÒ»¸öÔªËØ
e) index(x) ·µ»ØÊý×éÖеÚÒ»¸öֵΪxµÄλÖá£Èç¹ûûÓÐÆ¥ÅäµÄÔªËØ»áÅ׳öÒ»¸ö´íÎó
f) count(x) ·µ»ØxÔÚÊý×éÖгöÏֵĴÎÊý
g) sort() ¶ÔÊý×éÖеÄÔªËØ½øÐÐÅÅÐò
h) reverse() ¶ÔÊý×éÖеÄÔªËØÓõ¹ÐòÅÅÐò
2.dict£¨×ֵ䣩
×ֵ䣨Dictionary£©ÊÇÒ»ÖÖÓ³Éä½á¹¹µÄÊý¾ÝÀàÐÍ£¬ÓÉÎÞÐòµÄ“¼ü£Öµ¶Ô”×é³É¡£×ÖµäµÄ¼ü±ØÐëÊDz»¿É¸Ä±äµÄÀàÐÍ£¬È磺×Ö·û´®£¬Êý×Ö£¬tuple£»Öµ¿ÉÒÔΪÈκÎpythonÊý¾ÝÀàÐÍ¡£
1)¡¢Ð½¨×Öµä
>>> dict1={} #½¨Á¢Ò»¸ö¿Õ×Öµä
>>> type(dict1)
<type ‘dict’>
2)¡¢Ôö¼Ó×ÖµäÔªËØ£ºÁ½ÖÖ·½·¨
>>> dict1['a']=1 #µÚÒ»ÖÖ
>>> dict1
{’a': 1}
#µÚ¶þÖÖ£ºsetdefault·½·¨
>>> dict1.setdefault(’b',2)
2
>>> dict1
{’a': 1, ‘b’: 2}
3)¡¢É¾³ý×Öµä
#ɾ³ýÖ¸¶¨¼ü£Öµ¶Ô
>>> dict1
{’a': 1, ‘b’: 2}
>>> del dict1['a'] #Ò²¿ÉÒÔÓÃpop·½·¨£¬dict1.pop(’a')
>>> dict1
{’b': 2}
#Çå¿Õ×Öµä
>>> dict1.clear()
>>> dict1 #×Öµä±äΪ¿ÕÁË
{}
#ɾ³ý×Öµä¶ÔÏó
>>> del dict1
4)¡¢×ÖµäµÄ·½·¨
1)get(key,default=None)
·µ»Ø¼üÖµkey¶ÔÓ¦µÄÖµ£»Èç¹ûkeyûÓÐÔÚ×ÖµäÀÔò·µ»Ødefault²ÎÊýµÄÖµ£¬Ä¬ÈÏΪNone
>>> dict1 #¿ÕµÄ×Öµä
{}
>>> dict1.get(’a') #¼ü‘a’ÔÚdict1Öв»´æÔÚ£¬·µ»Ønone
>>> dict1.get(’d1′,’no1′) #default²ÎÊý¸ø³öÖµ’no1′£¬ËùÒÔ·µ»Ø’no1′
‘no1′
>>> dict1['a']=’no1′ #²åÈëÒ»¸öÐÂÔªËØ
>>> dict1
{’a': ‘1111′}
>
Ïà¹ØÎĵµ£º
¼Ìǰƪ¡¶Import Module¡·£¨http://blog.csdn.net/xiadasong007/archive/2009/09/02/4512797.aspx£©£¬¼ÌÐø·ÖÎöǶÈ벿·Ö»ù´¡ÖªÊ¶¡£Õâ´Î²»¶à˵£¬ÓÐʲôÎÊÌâ¼ÇµÃ¶à²éÓ¢ÎÄ×ÊÁÏ£¬¹úÄÚµÄÕâ·½ÃæÖªÊ¶ÉÙ
»¹ÊÇÀ´¿´´úÂ룬дÍêÎÒ¾Í˯¾õÁË~
#include "python/python.h"
#include <iostream>
using namespace std;
int ......
µ±½ñÓÐÐí¶àÃâ·ÑµÄ RDBMS£¨Relational Database Management
System£¬¹ØÏµÊý¾Ý¿â¹ÜÀíϵͳ£©£¬ÆäÖÐһЩÊÇ¿ª·ÅÔ´ÂëÈí¼þ£¬ÁíһЩÊÇÉÌÒµ³§ÉÌÌṩµÄÃâ·Ñ²úÆ·¡£Èç¹ûÄúÕýÔÚʹÓà C/C++¡¢Java™¡¢.NET
»ò PHP
¿ª·¢Ó¦ÓóÌÐò£¬ÏëѰÕÒÒ»ÖÖ¿É¿¿µÄÊý¾Ý·þÎñÆ÷£¬Ï£ÍûËüÖ§³ÖÏȽøµÄ¼¼Êõ¡¢¾ßÓв»¶ÏÀ©´óµÄ¿ª·¢ÈËÔ±ÉçÇø²¢ÒѾ²¿ÊðÔÚÐí¶à¹Ø¼ ......
Ä£¿é
Ò».¼ò½é
Ä£¿é»ù±¾ÉϾÍÊÇÒ»¸ö°üº¬ÁËËùÓÐÄ㶨ÒåµÄº¯ÊýºÍ±äÁ¿µÄÎļþ¡£ÎªÁËÔÚÆäËû³ÌÐòÖÐÖØÓÃÄ£¿é£¬Ä£¿éµÄÎļþÃû±ØÐëÒÔ.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½Å±¾µÄ¿ª·¢È«¹ý³Ì
ÎÊÌ⣺Íê³ÉÒ»¸ö¿ÉÒÔΪÎÒÃÇËùÓеÄÖØÒª³ÌÐò×ö±¸·ÝµÄ³ÌÐò¡£
²½Öè²ð½â£º
ÐèÒª±¸·ÝµÄÎļþºÍĿ¼ÓÉÒ»¸öÁбíÖ¸¶¨¡£
Îļþ±¸·Ý³ÉÒ»¸özipÎļþ¡£
zip´æµµµÄÃû³ÆÊǵ±Ç°µÄÈÕÆÚºÍʱ¼ä¡£
ÎÒÃÇʹÓñê×¼µÄzipÃüÁËüͨ³£Ä¬ÈϵØËæLinux/Unix·¢ÐаæÌṩ¡£WindowsÓû§¿ÉÒÔʹÓÃInfo-Zip³ÌÐò¡£×¢Òâ ......