Python (1)

Python 導論

Who am I?

  • 張楷翊
  • 元智資管 - 四年級
  • 精藤股份有限公司 - 實習生
  • 學了很多雜七雜八的東西
    Java、R、C++、網路架設 ...
  • 專長:網頁相關技術
    爬蟲 (pyhton)、Javascript、ASP.NET ...

這堂課希望的進行方式~

  • 大家不要害羞
  • 問題直接問
  • 互相切磋學習

今天的簡報在哪裡?

https://slides.kaiyeee.tw/today

QRCode

Python 可以做什麼?

Python 可以...

開發環境

Chocolatey (Windows)   https://chocolatey.org

套件管理器

            
              > @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
              
              PS> Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
            
          
Chocolatey Download Page

Brew (Mac)   https://brew.sh

套件管理器

            
              $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
            
          
HomeBrew Download Page

VSCode   https://code.visualstudio.com

編輯器

            
              $ brew cask install visual-studio-code
              > choco install vscode
            
          
VSCode Download Page

Python   https://python.org

            
              $ brew install python3
              > choco install python3
            
          
Python Download Page

Verify

            
              $ python3 -V
              > python -V
            
          
Python Verify Mac Python Verify Win

Hello World!

print()

            
              >>> print("Hello HSNU!")
              # Hello HSNU!
            
          

變數 (Variable)

變數

幫資料取一個名字,把資料儲存起來!

            
              >>> greeting = "Hello World!"
              >>> print(greeting)
              # Hello World
            
          

資料型態 (Data Type)

資料型態 (1)

  • int  整數
  • float  含小數點的數字
  • str  字串

資料型態 (2)

Python 可以不用指定型態

              
                >>> year = 2018
                >>> type(year)
                # class 'int'
                >>> price_of_iPhone_Xs = 999.00
                >>> type(price_of_iPhone_Xs)
                # class 'float'
                >>> year = "2018"
                >>> type(year)
                # class 'str'
              
            

資料型態 - 轉型

試試看數字和字串相加吧

              
                >>> a = 1
                >>> b = "2"
                >>> print(a + b)
                # Traceback (most recent call last):
                #   File "stdin", line 1, in "module"
                # TypeError: unsupported operand type(s) for +: 'int' and 'str'
                >>> print(a + int(b))
                # 3
                >>> print(str(a) + b)
                # 12
              
            

最後的最後...

裡面藏了很多東西,歡迎去挖寶:
https://github.com/Oschangkai

我的聯絡方式...
Email:  [email protected]
FB:  https://fb.com/kaiyeeeee
Telegram:  @kaiyeee

回饋表單

拜託大家幫我填個表單~~
https://slides.kaiyeee.tw/feedback

QRCode