Coder Social home page Coder Social logo

python's Introduction

Python

為什麼要學Python?
如何學Python?打造你的學習地圖!
Python 3和Python 2的主要差異

Python開發環境

Python開發環境@windwos

下載python
安裝Python2.7==>裝在D:\python2
安裝Python3.6==>裝在D:\python3{記得改成python3}

[1]使用python interactive shell
進入python
在cmd輸入python==>進入
離開==>exit()

[2]使用notepad++寫程式==>記得檔名要XXX.py
執行:
[1]進入你的程式目錄 D:\p3code (三年級)  D:\p_code(一(年級) 
[2]D:\python2\python.exe XXX.py
或 D:\python3\python.exe XXX.py

C:\p3code>path=c:\python3;%path%
C:\p3code>python hello.py

Python開發環境@Ubuntu 16.04 LTS 64-bit

使用虛擬開發環境

  • virtualenv
  • 使用Vagrant的虛擬開發環境

使用IDE

[1]輸入與輸出 USER INPUTS AND OUTPUTS:


[1.1]輸入:input | Raw_input
raw_input([prompt]) 函數從標準輸入讀取一個行,並返回一個字串(去掉結尾的分行符號)
input([prompt]) 函數和 raw_input([prompt]) 函數基本類似,但是 input 可以接收一個Python運算式作為輸入,並將運算結果返回。

從控制台讀取輸入資訊

[1.2]輸出:print

[1.3]格式化輸出Formatted Output

[2]各種資料型態(data type)及其運算[1][2][3][4]...[X]

識別字與關鍵字

數字型(numeric)資料型態及其運算
Integral 類型:整數類型|布爾型
浮點類型:浮點數|複數
二進位八進位十進位十六進位數字

字串(string)資料型態及其運算
如何操縱Unicode字串

Collection Data Types組合類型資料型態 
列表|串列(list)資料型態及其運算
元組(tuple)資料型態及其運算
辭典|字典(dic)資料型態及其運算
集合(set)資料型態及其運算

運算子:

  • Arithmetic Operators
  • 餘數運算子 (remainder|modulo)
  • Membership Operator
  • Comparison Operators Logical Operators

組合類型資料型態的高級特性:切片|迭代 |列表生成式 |生成器|迭代器

[3]迴圈與選擇(判斷)

迴圈::while | for loop  |沒有do-while  |range|break|continue
選擇:If |if-else| ..沒有switch
range break continue

[3.1]選擇:If |if-else| ..沒有switch

#猜數字游戲_版本一

西元年代對應到的十二生肖

[3.3]while 迴圈

#猜數字游戲_版本二:Python3

[程式開發作業]最大公因數


[3.3]range
range(start, stop[, step])

[4]函式/函數/function

function開發(功能)

可接受任意數量參數的函數
只接受關鍵字參數的函數
給函數參數增加元資訊
返回多個值的函數
定義有預設參數的函數
定義匿名或內聯函數
匿名函數捕獲變數值
減少可調用物件的參數個數
將單方法的類轉換為函數
帶額外狀態資訊的回呼函數
內聯回呼函數
訪問閉包中定義的變數

遞迴函式

[5]異常,例外處理與斷言 Exception Handling

[6]各種類型檔案存取技術

文字檔案存取技術

CSV檔案存取技術

圖片檔案存取技術

[7]各種類型資料庫存取技術

MYSQL資料庫存取技術

Postgresql資料庫存取技術

Mongodb資料庫存取技術

Redis資料庫存取技術

python's People

Contributors

happyhackinghigh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.