1.pythonå¤å°ä¸ªG
2.pythonè¦å¤å°å
åï¼pythonè¦å¤å¤§å
åï¼
3.pythonä¸ä¸ªå表è½è£
å¤å°ï¼
pythonå¤å°ä¸ªG
导读ï¼æ¬ç¯æç« é¦å¸CTOç¬è®°æ¥ç»å¤§å®¶ä»ç»æå ³pythonå¤å°ä¸ªGçç¸å ³å 容ï¼å¸æ对大家ææ帮å©ï¼ä¸èµ·æ¥ççå§ãæ¬æç®å½ä¸è§ï¼
1ãç»ç³»ç»ççå¤å°ç©ºé´å¥½?源码45级夜袭源码pythonå®è£ å¨åªä¸ªç好?2ãç¨python è·ä¸ä¸ªå°èæ¬ï¼è¦åå¤å°å å3ãpython æå¤å¯ä»¥è£ 满å¤å°ä¸ª4ã为ä»ä¹pythonæå æ1.5g5ãå为鸿èææ°åé çpythonï¼æ´æ´ä¸ªGï¼å»ºè®®æ¶èå.ç»ç³»ç»ççå¤å°ç©ºé´å¥½?pythonå®è£ å¨åªä¸ªç好?ç»ç³»ç»ççG-Gï¼pythonå®è£ å¨é¤Cç以å¤çä»»æçé½è¡ã
ç³»ç»çGå³å¯ï¼å¦ææ¯åºæå¯ä»¥ä¸ååºä¸è¿ä¸ºäºç®¡çæ¹ä¾¿è¶ è¿Gç建议ååºå®è£ å¨åªéé½å¯ä»¥ãç°å¨pythonå¼å常ç¨envç¯å¢ï¼æéåºå¨åªéé½æ æè°ãè¥éç¨å ¨å±ä¾èµå®è£ åéè¦æ¾ä¸ä¸ªå®¹é大çç符ã
ç¸å ³èµæ
ç³»ç»ä¿çååºæçæ¯Windowsç³»ç»å¨ç¬¬ä¸æ¬¡ç®¡ç硬ççæ¶åï¼ä¿çç¨äºåæ¾ç³»ç»å¼å¯¼æ件çååºãWindows Vista/7åºäºå®å ¨èèï¼å¨æ°è£ Windows 7ï¼å以åççæ¬ï¼è¿ç¨ä¸ï¼å¦æå©ç¨å ççååºå·¥å ·ç»ç¡¬çååºæ¶ï¼ç³»ç»é»è®¤çå°ä¸é¨åï¼-Mï¼ç空é´åååºæ¥ã
ä¸åé ç符ï¼ä½ å¨ç³»ç»ä¸çå°ç诸å¦CãDãEä¹ç±»çåæ¯ï¼ï¼ç¨äºåæ¾ç³»ç»å¼å¯¼æ件ï¼çµèå¯å¨æ¶éè¦é¦å 读åçä¸é¨åå ·æç¹æ®åè½çæ件ï¼ã
ç¨python è·ä¸ä¸ªå°èæ¬ï¼è¦åå¤å°å åå¯ä»¥æ£æµä¸ä¸
å·¥ä½ä¸éè¦æ ¹æ®æ个åºç¨ç¨åºå ·ä½åäºå¤å°å åæ¥å³å®æ§è¡æäºæä½ï¼æ以éè¦å个å°å·¥å ·æ¥æ¨¡æåºç¨ç¨åºä½¿ç¨å åæ åµï¼ä¸é¢æ¯æåçä¸ä¸ªPythonèæ¬çå®ç°ã
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import re
import time
def print_help():
print 'Usage: '
print 'python mem.py MB'
print 'python mem.py 1GB'
if __name__ == "__main__":
if len(sys.argv) == 2:
pattern = re.compile('^(\d*)([M|G]B)$')
match = pattern.match(sys.argv[1].upper())
if match:
num = int(match.group(1))
unit = match.group(2)
if unit == 'MB':
s = ' ' * (num * * )
else:
s = ' ' * (num * * * )
time.sleep()
else:
print_help()
else:
print_help()
使ç¨æ¹æ³å¦ä¸ï¼
python mem.py M
python mem.py 1G
python æå¤å¯ä»¥è£ 满å¤å°ä¸ª
ä½pythonçéå¶æ¯ä¸ªå ç´ ï¼ä½pythonçéå¶æ¯ä¸ªå ç´ ã
æ大容éå¾çæºå¨çæ§è½ææ ï¼PyList_Newä¸list并éæ 穷大ï¼å¨pythonæºç ä¸è§å®äºlistçæ大容éPY_SSIZE_T_MAXã
Pythonæåå§çå®ç°æ¯CPythonï¼å³ç¨Cå®ç°çPythonã对äºPythonä¸çListå ç´ æå¤è½å®¹çº³å¤å°ä¸ªå ç´ ï¼è¯å®è¿å¾ä»åºå±è§èä¸å»æº¯æºã
为ä»ä¹pythonæå æ1.5gä» ä» æ¬ç¨åº mä¸å°
anacondaä¹å°±mã
建议å®ç½ä¸è½½ï¼å ¶ä»å°åç»ä½ å äºä¸å 广åã
å为鸿èææ°åé çpythonï¼æ´æ´ä¸ªGï¼å»ºè®®æ¶èå.äºä¸åæç»æäºï¼ç¸ä¿¡å¤§å®¶å·²ç»æå ¥ç´§å¼ çå¦ä¹ ä¸äºï¼å°±å¨è¿éæç»å¤§å®¶ä¸ä¸ªç¦å©äºï¼å°±æ¯æç»å¤§å®¶æ´çäºä¸å¥å ¨å¥çpythonçå¦ä¹ æç¨ï¼æ å¿å享ç»å¤§å®¶ï¼è¿ä¸å¥è§é¢æ¯ä»å为鸿èæåæ¨èçä¸å¥pythonéåå¦ä¹ çµå书ï¼
é¢åæ¹å¼ï¼
å¨ä¸æ¹è¯è®º+ç§ä¿¡ï¼è¯·ç§ä¿¡âå¦ä¹ âå³å¯è·åè¿äºèµæï¼
ç»è¯ï¼ä»¥ä¸å°±æ¯é¦å¸CTOç¬è®°ä¸ºå¤§å®¶æ´ççå ³äºpythonå¤å°ä¸ªGçç¸å ³å 容解çæ±æ»äºï¼å¸æ对æ¨ææ帮å©ï¼å¦æ解å³äºæ¨çé®é¢æ¬¢è¿å享ç»æ´å¤å ³æ³¨æ¤é®é¢çæååï½
pythonè¦å¤å°å åï¼pythonè¦å¤å¤§å åï¼
æ¬ç¯æç« ç»å¤§å®¶è°è°pythonè¦å¤å°å åï¼ä»¥åpythonè¦å¤å¤§å å对åºçç¥è¯ç¹ï¼å¸æ对åä½ææ帮å©ï¼ä¸è¦å¿äºæ¶èæ¬ç«åãæ¬æç®å½ä¸è§ï¼
1ãå¦pythonç¨ä»ä¹é ç½®ççµè2ãpythonjavaç¨åºå 大å°3ãpythonç¼ç¨8gçå åå¤ä¹4ãå¦Pythonçµèè¦ä»ä¹é ç½®ï¼5ãæpython人工æºè½ï¼æºå¨å¦ä¹ ï¼çµèè¦å¤å°å åï¼å¤å°å¨åï¼å¦pythonç¨ä»ä¹é ç½®ççµèpython对äºçµè硬件åºæ¬æ²¡ä»ä¹è¦æ±ï¼ä¸è½½pythonå®è£ ç¨åºçæ¶åï¼æ³¨æçä¸èªå·±çµèå±æ§æ¯ä½ç³»ç»è¿æ¯ä½ç³»ç»ï¼åä¸è½½å¯¹åºç
pythonå®è£ ç¨åºã
ç°å¨çµèçåç§é ç½®åå¯ä»¥ç¨æ¥å¦ä¹ pythonï¼èçèµæ¬ãå¥è ¾4 m å åæè å åå³å¯ï¼g以ä¸ç¡¬çã ä¸è¬æ¥è¯´è½è·å¨winxpæ
è linux å°±å¯ä»¥ã æç®åçæ¯ä½¿ç¨æ èæ´¾ã
å纯å¦Pythonçè¯æ®éçµèå°±okäºï¼æºå¨å¦ä¹ å 大åºç¡ç®æ³é½okï¼å¦æ·±åº¦å¦ä¹ çè¯å°å¼æ èä¸tiæè æ³°å¦xpï¼å ¶ä»é ç½®çä¸å级空
é´ãç¬è®°æ¬çè¯è¦å¼ºå²ç¹çï¼æ好带åºæ硬çï¼æ¯æGå åæ以ä¸ï¼å¸¦æè±ä¼è¾¾ä»¥ä¸çæ¾å¡ã
å½ç¶ï¼å¦æææ¡ä»¶ï¼è¿æ¯æ¨èmacçï¼ä¼ç¹ä¸ç¨è¯´ï¼
ä¹°ä»ä¹çµèè¿è¦æ ¹æ®èªèº«çå®é æ åµæ¥å³å®ï¼å¦ææ¯å¦çå ï¼å»ºè®®æ®éçç¬è®°æ¬å°±å¯ä»¥ï¼æ²¡å¿ è¦è±å¤§ä»·é±æ¥çº ç»è¿äºï¼å¦æä¸çæï¼æä¸
å®çç»æµåºç¡ï¼å¯ä»¥éæ©é«ç«¯ä¸ç¹ç产åãè¯è¯´åæ¥ï¼pythonæ¯æ¯æ跨平å°ï¼ä¸»æµç³»ç»é½æ¯æï¼è³äºå欢åªä¸ªï¼è¿æ¯æ ¹æ®æ¨ç个人å好æ¥ã
æ¨èå¦ä¹ ãpythonæç¨ãã
pythonjavaç¨åºå 大å°
é¦å ï¼ä½å¹³å°ç论ä¸æå¤å¯ä»¥æ¯æ2**ï¼æ4GBãä½æä½ç³»ç»èªå·±ä¿çäºå ¶ä¸çä¸å¤§é¨åãå¨Windowsä¸ï¼é»è®¤æ åµä¸ï¼è¿ä¸ªæ°æ®åæ¯æ´ä¸ª2GBç(æ¨å¯ä»¥å°å ¶é 置为æ´ä½ï¼ä½æäºè½¯ä»¶å¯è½ä¼å´©æºï¼å 为å®åå®ä½¿ç¨âç¾åæéâæ¯å®å ¨ç)ï¼èå¨å ¶ä»å¹³å°ä¸ï¼å®é常æ´åMBã
类似å°ï¼ä½å¹³å°ç论ä¸æå¤å¯ä»¥æ¯æ2**ï¼æEBãå¨è¿éï¼æ 论æä½ç³»ç»çåå¨å®¹éæ¯MBè¿æ¯2GBï¼é½ä¸ä¼äº§çæ¾èçå½±åã
ä½æ¯ï¼æ¨ç硬件å¯è½ä¼éå¶å¨å°ä½ä¹é´(大å¤æ°å½åç³»ç»æ¯ä½)ï¼èä½åªæTBã
ä½ çæä½ç³»ç»å¯è½ä¼æäºæ éå¶å¾æ´è¿ãIIRCï¼ææ©çä½linuxå æ ¸åªä½¿ç¨ä½(å 为å½æ¶æ²¡æ硬件å¯ä»¥ä½¿ç¨æ´å¤)ï¼åªæ1TBã
æåï¼å¨Windowsä¸ï¼å¦æä½ ä½¿ç¨çæ¯âbasicâæâstarterâçæ¬ï¼é£ä¹å¯¹äºwindows8homebasicçæ¬ï¼å®å¯è½ä¼éå¶å°8GBãè¿æ¯å¯ä¸ä¸ä¸ªå¯è½å½±åä½ çæ件ã
ä½æ¯ï¼ä¸åæ¥ä½çæ åµä¸åï¼å¹´å ä¹æ²¡æ人æ¥ææ¯ä»ä»¬çæä½ç³»ç»ä¸æ¬¡å页æ´å¤çç©çRAMãå¾å¤äººå¨å åè¶ è¿4GBçæºå¨ä¸è¿è¡ä½Windows(æè ä½Windowsä¸è¿è¡ä½Python)ï¼ä½æ¯è¦å¨ä¸ä¸ªä½ç³»ç»ä¸å è½½ä¸ä¸ªä½æéæä½ç³»ç»çRAMè¶ è¿1TBå ä¹æ¯ä¸å¯è½çã
å æ¤ï¼æ 论æ¨æå¤å°RAMï¼æ¨é½åºè¯¥è½å¤å°å ¶å¤§é¨åç¨äºmmapã
ææ¶ï¼æ¨å¸æmmapä¸ä¸ªå®é ä¸æ æ³æ¾å ¥RAMçæ件ãç¶åï¼æ¨å°ä¾èµäºæä½ç³»ç»ç页é¢äº¤æ¢ï¼è¿å½ç¶æ¯çªå£åæ´å°çæ件æ å°æçè¦ä½ï¼ä½å¯è½è¶³å¤é«æï¼èä¸å¯è½è¦ç®åå¾å¤ã
å¨è¿ç§æ åµä¸ï¼å®å¯è½ä¼å¨ä½ çç³»ç»ä¸å·¥ä½ï¼ä½æ¯å¦æä½ ä¸ç¥éæ¯ä½ åè¯æ们çæ´å¤çä¿¡æ¯ï¼é£å°±æ²¡æåæ³ç¡®å®äºãæç®åççæ¡(åPythonä¸æ ·)æ¯EAFPï¼å°è¯å®ï¼å¹¶åå¤å¤çå®å¤±è´¥çå¼å¸¸(æ 论æ¯éè¿ç¼ç¨æ¹å¼ï¼è¿æ¯éè¿è¯»åå æ è·è¸ªå¹¶æç´¢StackOverflowæ¥å¯»æ¾è§£å³æ¹æ¡
pythonç¼ç¨8gçå åå¤ä¹å纯çå¦ä¹ çè¯å¤ï¼åºç¨èµ·æ¥ï¼å¹²é¡¹ç®ï¼è¯·ç´æ¥gbï¼è¦ä¸ä½ ä¼ç¯äºç
å¦Pythonçµèè¦ä»ä¹é ç½®ï¼å¯ä»¥åèå¦ä¸é ç½®ï¼
CPUä¸ºé ·ç¿i5 / i7
å å 4G / 8G
硬ç Gï¼æè ç¨ SSD
åé¢ä¸ä¸ªä¸ºåºç¡é ç½®ï¼åé¢ç为æ´å¥½çé项ãç½ä¸ä»·æ ¼ ~ ã
æ´éè¦çï¼åéåéè¦æ°æ®ãéè¦éåå¼æç³»ç»ï¼è¿éè¦å¾å¤å¼åå·¥ä½ï¼å¯ä»¥èªå·±æåæ°æ®åç¨å¼æºçåæµå¼æã
Pythonæ¯çº¯ç²¹çèªç±è½¯ä»¶ï¼ æºä»£ç å解éå¨CPythonéµå¾ª GPL(GNU General Public License)åè®®ãPythonè¯æ³ç®æ´æ¸ æ°ï¼ç¹è²ä¹ä¸æ¯å¼ºå¶ç¨ç©ºç½ç¬¦(white space)ä½ä¸ºè¯å¥ç¼©è¿ã
Pythonå ·æ丰å¯å强大çåºãå®å¸¸è¢«æµç§°ä¸ºè¶æ°´è¯è¨ï¼è½å¤æç¨å ¶ä»è¯è¨å¶ä½çåç§æ¨¡åï¼å°¤å ¶æ¯C/C++ï¼å¾è½»æ¾å°èç»å¨ä¸èµ·ã
éè¦æ³¨æçæ¯å¨æ¨ä½¿ç¨æ©å±ç±»åºæ¶å¯è½éè¦èèå¹³å°é®é¢ï¼æäºå¯è½ä¸æä¾è·¨å¹³å°çå®ç°ã
7ææ¥ï¼IEEEåå¸å¹´ç¼ç¨è¯è¨æè¡æ¦ï¼Pythoné«å± é¦ä½
æpython人工æºè½ï¼æºå¨å¦ä¹ ï¼çµèè¦å¤å°å åï¼å¤å°å¨åï¼ä¸ªäººä½¿ç¨æè§ï¼æ好GçSSDãGå åï¼æ好MHz以ä¸ï¼èµ·æ¥
å«å¿äºå¥½æ¾å¡ãæ¾å¡ãæ¾å¡ï¼
pythonè¦å¤å°å åçä»ç»å°±èå°è¿éå§ï¼æè°¢ä½ è±æ¶é´é 读æ¬ç«å 容ï¼æ´å¤å ³äºpythonè¦å¤å¤§å åãpythonè¦å¤å°å åçä¿¡æ¯å«å¿äºå¨æ¬ç«è¿è¡æ¥æ¾åã
pythonä¸ä¸ªå表è½è£ å¤å°ï¼
导读ï¼æ¬ç¯æç« é¦å¸CTOç¬è®°æ¥ç»å¤§å®¶ä»ç»æå ³pythonä¸ä¸ªå表è½è£ å¤å°çç¸å ³å 容ï¼å¸æ对大家ææ帮å©ï¼ä¸èµ·æ¥ççå§ãpythonæå¤å¯ä»¥è£ 满å¤å°ä¸ªä½pythonçéå¶æ¯ä¸ªå ç´ ï¼ä½pythonçéå¶æ¯ä¸ªå ç´ ã
æ大容éå¾çæºå¨çæ§è½ææ ï¼PyList_Newä¸list并éæ 穷大ï¼å¨pythonæºç ä¸è§å®äºlistçæ大容éPY_SSIZE_T_MAXã
Pythonæåå§çå®ç°æ¯CPythonï¼å³ç¨Cå®ç°çPythonã对äºPythonä¸çListå ç´ æå¤è½å®¹çº³å¤å°ä¸ªå ç´ ï¼è¯å®è¿å¾ä»åºå±è§èä¸å»æº¯æºã
Pythonå表æå¤å¯ä»¥æ¾å¤å°æ°æ®
ä¸è¬åºç¨åºæ¯é½ä¸ç¨èèè¿ä¸ªå¤§å°ï¼å 为è¿ä¸ªä¸éå¾é«ï¼
éè¦ç¨å°è¿ä¹å¤å ç´ çlistçæ¶åï¼é½éè¦èèå¾å¤å ¶å®é®é¢ã
1----------ä½pythonçéå¶æ¯ä¸ªå ç´ ã
2----------ä½pythonçéå¶æ¯ä¸ªå ç´ ã
pythonä¸listç大å°æ大æ¯å¤å°ä¸è¬åºç¨åºæ¯é½ä¸ç¨èèè¿ä¸ªå¤§å°ï¼å 为è¿ä¸ªä¸éå¾é«ï¼éè¦ç¨å°è¿ä¹å¤å ç´ çlistçæ¶åï¼é½éè¦èèå¾å¤å ¶å®é®é¢ã
1ï¼ä½pythonçéå¶æ¯ä¸ªå ç´ ã
2ï¼ä½pythonçéå¶æ¯ä¸ªå ç´ ã
ãPythonã
1ï¼Python(è±è¯åé³:/?pa?θ?n/),æ¯ä¸ç§é¢å对象ã解éå计ç®æºç¨åºè®¾è®¡è¯è¨ï¼ç±GuidovanRossumäºå¹´åºåæï¼ç¬¬ä¸ä¸ªå ¬å¼åè¡çåè¡äºå¹´ï¼Pythonæºä»£ç åæ ·éµå¾ªGPL(GNUGeneralPublicLicense)åè®®ãPythonè¯æ³ç®æ´èæ¸ æ°ï¼å ·æ丰å¯å强大çç±»åºãå®å¸¸è¢«æµç§°ä¸ºè¶æ°´è¯è¨ï¼è½å¤æç¨å ¶ä»è¯è¨å¶ä½çåç§æ¨¡å(å°¤å ¶æ¯C/C++)å¾è½»æ¾å°èç»å¨ä¸èµ·ã
2ï¼å¸¸è§çä¸ç§åºç¨æ å½¢æ¯ï¼ä½¿ç¨Pythonå¿«éçæç¨åºçåå(ææ¶çè³æ¯ç¨åºçæç»çé¢)ï¼ç¶åå¯¹å ¶ä¸æç¹å«è¦æ±çé¨åï¼ç¨æ´åéçè¯è¨æ¹åï¼æ¯å¦3D游æä¸çå¾å½¢æ¸²æ模åï¼æ§è½è¦æ±ç¹å«é«ï¼å°±å¯ä»¥ç¨C/C++éåï¼èåå°è£ 为Pythonå¯ä»¥è°ç¨çæ©å±ç±»åºãéè¦æ³¨æçæ¯å¨æ¨ä½¿ç¨æ©å±ç±»åºæ¶å¯è½éè¦èèå¹³å°é®é¢ï¼æäºå¯è½ä¸æä¾è·¨å¹³å°çå®ç°ã
ç»è¯ï¼ä»¥ä¸å°±æ¯é¦å¸CTOç¬è®°ä¸ºå¤§å®¶ä»ç»çå ³äºpythonä¸ä¸ªå表è½è£ å¤å°çå ¨é¨å 容äºï¼å¸æ对大家ææ帮å©ï¼å¦æä½ è¿æ³äºè§£æ´å¤è¿æ¹é¢çä¿¡æ¯ï¼è®°å¾æ¶èå ³æ³¨æ¬ç«ã