1.pythonå¤å°ä¸ªG
pythonå¤å°ä¸ªG
导读ï¼æ¬ç¯æç« é¦å¸CTOç¬è®°æ¥ç»å¤§å®¶ä»ç»æå ³pythonå¤å°ä¸ªGçç¸å ³å 容ï¼å¸æ对大家ææ帮å©ï¼ä¸èµ·æ¥ççå§ãæ¬æç®å½ä¸è§ï¼
1ãç»ç³»ç»ççå¤å°ç©ºé´å¥½?源码cms源码苹果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çç¸å ³å 容解çæ±æ»äºï¼å¸æ对æ¨ææ帮å©ï¼å¦æ解å³äºæ¨çé®é¢æ¬¢è¿å享ç»æ´å¤å ³æ³¨æ¤é®é¢çæååï½