[Python] 如何將 Numpy 資料格式轉成 Tuple 或 List
在 Python 中,若是說到陣列、多維度相關的資料處理,那想必無庸置疑地會想到 Numpy
,這是因為 Numpy
是一個使用了 C/C++ 和 Fortran 所構成的優化函式庫,運算效能是非常快的。
在 Python 中,若是說到陣列、多維度相關的資料處理,那想必無庸置疑地會想到 Numpy
,這是因為 Numpy
是一個使用了 C/C++ 和 Fortran 所構成的優化函式庫,運算效能是非常快的。
今天當我在 Linux 環境中安裝 Python 指定版本時,出現以下錯誤訊息:
Read More »[已解決][Linux] 安裝 Python 出現錯誤訊息: zipimport.ZipImportError: can't decompress data今天我在新配置的環境中,使用 pip3 install PyQt5
指令安裝 Python 套件時,出現了以下報錯訊息:
ModuleNotFoundError: No module named 'distutils.util'
Read More »[已解決][Python] ModuleNotFoundError: No module named 'distutils.util'本來我經營個人網站,主要是寫我自己的學習的筆記,方便我日後自己查看。不過幾個禮拜前,我偶然被一個下班後想要精進、學習寫程式的朋友詢問了:我該如何取得數值的小數點?
Read More »[Python] 取數值小數點的方法(指定位數、四捨五入)AppleScript 是在 MacOS 等作業系統上的一種腳本,可以很好地調用到在 MacOS 等作業系統上其他程式語言難以調用的功能。比方說:自定義一個應用程式視窗尺寸。
而在我透過 AppleScript 結合 MacOS 上的 Automator 工具製作快捷鍵功能後,我驚覺這些快捷鍵啟動的速度,其實非常非常地慢。
Read More »[Python] 在程式碼中執行 AppleScript 語法switch 是一種在眾多程式語言當中都有支援的語法,跟 if-else 功能很相似,不過跟設定任意條件的 if-else 不同,switch 更是針對單一條件的不同情況來執行程式碼,在許多時候比 if-else 來得更直覺。
Read More »[Python] 3.10 先覽版本開始支援 switch 功能(透過 match 語法)最近比較多網友詢問了我關於如何透過程式在 WordPress 上發表文章,正好藉這次的機會,嘗試使用之前比較沒有研究的 REST API 來達到發表文章的目的。
Read More »[WordPress] 使用 REST API 發表文章在使用 WordPress 架設網站的過程中,我們可能早就發表了數也數不清數量的文章。那麼,若有一天,我們需要取得所有發表過的文章資訊時,究竟應該要怎麼做呢?
Read More »[WordPress] 取得所有發表過的文章The count-and-say sequence is a sequence of digit strings defined by the recursive formula:
- countAndSay(1) = "1"
- countAndSay(n) is the way you would "say" the digit string from countAndSay(n-1), which is then converted into a different digit string.
To determine how you "say" a digit string, split it into the minimal number of groups so that each group is a contiguous section all of the same character. Then for each group, say the number of characters, then say the character. To convert the saying into a digit string, replace the counts with a number and concatenate every saying.
Given a positive integer n, return the nth term of the count-and-say sequence.
Example:
Input: n = 1
Output: "1"
Explanation: This is the base case.
Input: n = 4
Output: "1211"
Explanation:
countAndSay(1) = "1"
countAndSay(2) = say "1" = one 1 = "11"
countAndSay(3) = say "11" = two 1's = "21"
countAndSay(4) = say "21" = one 2 + one 1 = "12" + "11" = "1211"
Read More »LeetCode: 38-Count and Say 解題紀錄