python之編程語言(簡介)02

Python介紹
發展史
    Python 2.6 - October 1, 2008 
    Python 2.6.1 - October 1, 2008 
    Python 2.6.6 - October 1, 2008 
    Python 3.0 - December 3, 2008 
    Python 2.7 - July 3, 2010  #目前業內主流使用的工業版本依然是2.7
    
    print "hello world" #in 2.x
    print("hello world") #in 3.x
    
    
    In summary : Python 2.x is legacy, Python 3.x is the present and future of the language
    
    總結: python2.x 是遺產, python3.x是現在和未來的語言
    
    Python 3.0 was released發佈 in 2008. The final最終 2.x version 2.7 release came out in mid-2010,
    with a statement聲明 of extended延長 support支持 for this end-of-life release. The 2.x branch分支 will see no new major重大 releases after that.
    3.x is under active development 正在活躍的開發 and has already已經 seen有了 over超過 five years of stable穩定的 releases版本, including包括 version版本 3.3 in 2012,
                3.4 in 2014, and 3.5 in 2015. This means意味着 that all recent近期的 standard標準的 library庫 improvements升級/改進, for example例子, are only
                available可用的 by default默認 in Python 3.x.

2.x = 默認編碼 =ASSIC =不支持
3.x = 默認編碼 =UNICODE =默認支持中文

Guido van Rossum (the original creator of the Python language) decided決定 to clean up清理 Python 2.x properly適當的,
 with less regard不管 for backwards向後 compatibility兼容 than is the case for new releases in the 2.x range. 
The most drastic激進的 improvement is the better更好的 Unicode(是一個編碼)中文支持 support (with all text字符 strings being Unicode by default) 
as well as saner bytes/Unicode separation.

Besides另外, several幾個 aspects方面 of the core核心 language (such as print and exec being statements, integers using floor division)
 have been adjusted調整爲 to be easier更簡單的 for newcomers新手 to learn and to be more consistent持續的 with the rest of the language, 
and old cruft has been removed (for example, all classes are now new-style, "range()" returns a memory efficient iterable, not a list as in 2.x). 

python 2 vs 3
    1。 默認支持中文
    2. 不兼容2.x 
    3. 核心語法調整,更易學
    4. 新特性默認只在3.x上有
    


    
    系統位數
    
    32bit =內存的最大尋址空間是2**32, 4GB 
    64bit, =2**64 但實際上支持不到這麼大的內存(實際2**4x), 目前主板支持的最大的內存是100多GB
    
    
    4gb ==64位系統 會不會比32位系統快? = 一樣的 
    
    硬盤:
        5400轉 = 每分鐘 =騎自行車
        7200轉 = 每分鐘 =騎電動車
        10000轉 = 每分鐘 =騎快速電動車
        15000轉 = 每分鐘 =騎摩托車  機械硬盤最快的
        
        固態硬盤SSD =    Tesla 
        
    
    
    
Python 2 VS 3
1.默認支持中文
2.不兼容2.x
3.核心語法調整,更易學
4.新特性默認只在3.x 上有

    cmd交互器模式
    
    開始--》cmd --> cd c:\  -->dir 
    cd = change directory 
    dir = 查看當前目錄文件列表
    
    
    cd .. 返回上一層目錄
    cd ../.. 返回上上一層目錄
    cd ../../.. 返回上上上一層目錄
    cd ../../../.. 返回上上上上一層目錄
    
    


    D:\>"d:\Program Files\Python35\python.exe" c:\hello.txt
    Hello World!
        
    
    #c:\hello.txt   .txt 代表文件的擴展名(後綴名),用於區分文件類型
    .txt 記事本文本文件
    .doc word文件
    .xls excel文件
    .ppt PPT文件
    .exe 可執行文件
    .jpg .png  .jpeg  圖片
    .gif 動態圖片
    .pdf     PDF文件
    .mp4 .avi 視頻
    .py   python文件
    .java java 文件
    .c .h  c源碼
    .php php文件
    .js   javascript 

    環境變量
    
    D:\Program Files\Python35\Scripts\;
    D:\ProgramFiles\Python35\;
    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
    D:\Program Files\Python27
    
    
    執行py程序方式爲:
        1. 交互器,缺點程序不能永久保存,主要用與簡單的語法測試相關
        2. 文件執行
    
    內存何時釋放?
    
    
    字符編碼
    支持中文的第一張表就叫 GB2312 
    
    1980年 gb2312 6700+
    1995年 gbk1.0 20000
    2000年 gb18030 27000 
    big5 臺灣
    
    unicode 萬國碼  支持所有國家和地區的編碼 
    2**16 = 65535 = 存一個字符 統一佔用2個字節
    
    
    UTF-8 = unicode 的擴展集,可變長的字符編碼集
    
    Assic -->Gb2312 ->gbk1.0-->gb18030 
    Assic -->unicode -->utf-8   /utf-16 
    
    
    Python2.x == Assic 默認編碼
        #!-*- coding:utf-8 -*- 
        #coding:utf-8 
        
    python3.x == unicode默認編碼 
    
    
    unicode 是向下兼容gb2312 , gbk 
    
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章