原创 Python 面向對象編程OOP (四) 寫類神器:attrs

使用attrs解放雙手 大家好,這一期我想和大家分享一個OOP編程的高效神器:attrs庫 首先我們來介紹下 attrs 這個庫,其官方的介紹如下: attrs 是這樣的一個 Python 工具包,它能將你從繁綜複雜的實現上解脫出來,享受編

原创 Python 面向對象編程OOP (三) 類方法,靜態方法

類的方法概覽 首先回顧一下Python OOP常見的三種方法: instance method 實例/接口方法 class method 類方法 static method 靜態方法 標準書寫方式如下: class M

原创 Python 面向對象編程OOP (一) 類,對象,屬性,訪問權限

Python面向對象編程之旅 OOP編程是什麼 大家好,作爲小白,最近學習了很多Python OOP編程的知識,因爲腦容量有限,特此一一按照學習順序記錄下來,如果哪裏有錯誤,還請大神儘快指出,以免誤導他人。。。 首先讓我們簡單瞭解一下何爲面

原创 Python基礎練習100題 ( 91~ 100)

刷題繼續 昨天和大家分享了81-90題,今天繼續來刷最後的91-100題 Question 91: Please write a program which accepts a string from console and print

原创 Python基礎練習100題 ( 81~ 90)

刷題繼續 昨天和大家分享了71-80題,今天繼續來刷81~90題 Question 81: By using list comprehension, please write a program to print the list afte

原创 Python基礎練習100題 ( 71~ 80)

刷題繼續 昨天和大家分享了61-70題,今天繼續來刷71~80題 Question 71: Please write a program to output a random number, which is divisible by 5

原创 Python基礎練習100題 ( 61~ 70)

刷題繼續 昨天和大家分享了51-60題,今天繼續來刷61~70題 Question 61: The Fibonacci Sequence is computed based on the following formula: f(n)=0

原创 Python基礎練習100題 ( 51~ 60)

刷題繼續 昨天和大家分享了41-50題,今天繼續來刷51~60題 Question 51: Write a function to compute 5/0 and use try/except to catch the exceptions

原创 Python基礎練習100題 ( 41~ 50)

刷題繼續 大家好,我又回來了,昨天和大家分享了31-40題,今天繼續來看41~50題 Question 41: Write a program which can map() to make a list whose elements ar

原创 Python基礎練習100題 ( 31~ 40)

刷題繼續 昨天和大家分享了21-30題,今天繼續來刷31~40題 Question 31: Define a function which can print a dictionary where the keys are numbers

原创 Python基礎練習100題 ( 21~ 30)

刷題繼續 昨天和大家分享了前10道題,今天繼續來刷21~30 Question 21: A robot moves in a plane starting from the original point (0,0). The robot c

原创 Python基礎練習100題 ( 11~ 20)

刷題繼續 上一期和大家分享了前10道題,今天繼續來刷11~20 Question 11: Write a program which accepts a sequence of comma separated 4 digit binary

原创 Python基礎練習100題 ( 1~ 10)

一套全面的練習,大家智慧的結晶 大家好,好久不見,我最近在Github上發現了一個好東西,是關於夯實Python基礎的100道題,原作者是在Python2的時候創建的,閒來無事,非常適合像我一樣的小白來練習 對於每一道題,解法都不唯一,我在

原创 Pandas之旅(七) 誰說pandas慢

Pandas 加速 大家好,今天我們來看有關pandas加速的小技巧,不知道大家在剛剛接觸pandas的時候有沒有聽過如下的說法 pandas太慢了,運行要等半天** 其實我想說的是,慢不是pandas的錯,大家要知道pandas本身是在

原创 Pandas之旅(六): 字符串實用方法彙總

有關字符串基本方法 大家好,我又回來了! 之前的幾期我們已經簡單瞭解了pandas的基礎操作,但是隻要涉及到數據,最常見的就是String(字符串)類型,所以很多時候我們其實都在和字符串打交道,所以今天,我會把我自己總結的,有關字符串的常用