Skip to content

Benjr.tw

  • Linux
    • Stress & Performance
    • Hardware Info
    • System Monitor
    • Security
    • Desktop
    • PXE
    • Filesystem Hierarchy Standard
    • Linux 開機選項
    • Linux Package Manager
    • 備份 Backup
  • Virtualization
    • Docker & Podman
    • CoreOS
  • NAS/SAN
  • Programming Language
    • Bash shell script
    • Perl
    • PHP
    • Python
    • Node.JS
  • WordPress
  • DataBase
    • 資料庫安裝
    • 資料庫語法
    • MariaDB JSON

Python

Python – docstring

2022-05-192022-05-19 adminLinux, Programming Language, Python, RedHat / CentOS

測試環境為 CentOS 8 x86_64 (虛擬機) 在 function 的第一行可以使用一段字串(需使用 ”’ String ”’ 或是 “”” String “””)來描述 […]

Read more

Python – _ (底線) 與 _ _(雙底線)

2022-05-182022-05-19 adminLinux, Programming Language, Python, RedHat / CentOS

第一次看到 Python 的 Code 時候發現寫法使用很多 _ (底線) 與 _ _(雙底線),原來是有其建議規定的. 參考文章 – https://medium.com/bits-to-blocks/python%E4%B8%AD%E7%9A%84underscore-%E8%88% […]

Read more

Python – __init__ , __str__ , __repr__

2022-05-182022-05-18 adminLinux, Programming Language, Python, RedHat / CentOS

測試環境為 CentOS 8 x86_64 (虛擬機) __init__ , __str__ , __repr__ 是 Class 預設 method .下面來看一下使用的時機點. Class 範例如下. 執行結果 說明: __init__ 建構式 (Constructor) __init__() […]

Read more

Python – Property & _attribute

2022-05-182022-05-18 adminLinux, Programming Language, Python, RedHat / CentOS

測試環境為 CentOS 8 x86_64 (虛擬機) 使用 Property 時可以把 類別(Class) 的 屬性 (Attribute) 轉換為唯讀,存取只能透過 屬性的 setter , getter 與 deleter 方法 (Method) , 參考文章 – https:// […]

Read more

Python – instance attribute & class attribute

2022-05-172022-05-17 adminLinux, Programming Language, Python, RedHat / CentOS

測試環境為 CentOS 8 x86_64 (虛擬機) Class 的 屬性 (Attribute)是用來存放 Object 的資料.屬性 (Attribute) 有分 實例屬性(instance attribute) 與 類別屬性(class attribute). 實例屬性 (instance […]

Read more

Python – Try-except statement

2022-05-162022-05-16 adminLinux, Programming Language, Python, RedHat / CentOS

測試環境為 CentOS 8 x86_64 (虛擬機) Try-except statement 格式如下. 下面範例輸入兩整數,並透過 Try-except 來避免錯誤發生. 因為有發生 ZeroDivisionError 所以執行 except ZeroDivisionError 區塊. 發生非 […]

Read more

Python – Class

2022-05-162022-05-17 adminLinux, Programming Language, Python, RedHat / CentOS

測試環境為 CentOS 8 x86_64 (虛擬機) 關於 Python Class 與其相關 專有名詞 說明,參考文章 – https://www.learncodewithmike.com/2020/01/python-class.html 類別 (Class) 物件 (Objec […]

Read more

Python – Module

2022-05-132022-05-13 adminLinux, Programming Language, Python, RedHat / CentOS

測試環境為 CentOS 8 x86_64 (虛擬機) Module 模組的使用. 要使用剛剛定義好的 Module 模組只需要透過 import modeule 名稱,即可使用.使用時 模組名稱.函數名稱 執行結果. __name__ 通常會直接在 Module 裡面就會測試一下函數的功能. 執行 […]

Read more

Python – Function

2022-05-132022-05-13 adminLinux, Programming Language, Python, RedHat / CentOS

測試環境為 CentOS 8 x86_64 (虛擬機) Function 的使用. 使用輸入參數 n 跟 m . 執行結果. 使用 return 回傳值. 執行結果. 預設引數值 使用預設 輸入參數 n=1 跟 m=1 . 執行結果. 關鍵字引數 在呼叫函數時指定其參數名稱. 執行結果.

Read more

Python – dict 資料型態物件

2022-05-132022-05-13 adminLinux, Programming Language, Python, RedHat / CentOS

測試環境為 CentOS 8 x86_64 (虛擬機) 一般宣告的 List(串列)資料型態,其資料不好搜尋到,這時候可以使用 dic ( dictionary ),資料是由 key (鍵值,可使用 括字串(str),整數(int)與浮點數(float) ) + Value (值,可以為任何東西) […]

Read more

文章導覽

較舊的文章

近期文章

  • Python – docstring
  • Python – _ (底線) 與 _ _(雙底線)
  • Python – __init__ , __str__ , __repr__
  • Python – Property & _attribute
  • Python – instance attribute & class attribute

近期留言

  • 「N/A」於〈Linux – iperf (Bind to host)〉發佈留言
  • 「topvpn」於〈就是要上網 – OpenVPN ( 二) Client〉發佈留言
  • 「zoeyalee」於〈在 WordPress 使用 Facebook 讚的連結〉發佈留言
  • 「Carter」於〈VMware PXE 安裝〉發佈留言
  • 「路人甲」於〈iperf – Bidirectional test (雙向測試)〉發佈留言

分類

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文
Powered by WordPress | Theme: Astrid by aThemes.