作者查詢 / Typebrook
作者 Typebrook 在 PTT [ Python ] 看板的留言(推文), 共72則
限定看板:Python
看板排序:
全部MountainClub250Steam107Linux74Python72NTUBSE-B-9736C_Chat32Soft_Job16Militarylife14MobileComm13rent-exp13Military10Gossiping9Editor7Hiking6Ghost-Shell5MH5NTU5SLG5StarCraft5StupidClown5C_and_CPP4outdoorgear4book3KS97-3123NTU_Service3sttmountain3bicycle2Kaohsiung2Lambda2NCHU-Mount2Web_Design2Android1AntiVirus1CrossStrait1Google1HatePolitics1KS_Scouts1model1NTU-K91NtuDormM21OgreBattle1Old-Games1RealPlaying1TY_Research1<< 收起看板(44)
2F→: 使用系統管理員權限執行cmd呢?10/16 09:03
4F推: 感謝解說,之前看文件都沒想到這個地步10/14 12:46
3F→: 因為你的f並非字串(str), 建議你第一行改為10/13 00:22
4F→: f = open('file_name').read() f即為整個檔案的字串10/13 00:24
5F→: 然後要找匹配字出現的次數,不需用到re.finditer10/13 00:25
6F→: len(re.findall(s, f)) 即可10/13 00:26
7F→: 另外提一點,若你只是要找特定字串而非pattern10/13 13:21
8F→: 就不需要用正規表達式(re module),用str.count即可10/13 13:22
9F→: 內建的*運算符明明很棒... print(*a)10/09 16:59
1F→: 沒錯,input的引數會和print一樣,輸出至sys.stdout10/07 20:53
2F→: https://goo.gl/u5Lxxe10/07 20:54
1F→: 我猜你把不想執行的程式碼寫在同一個標號(>>>)下面了10/07 19:54
2F→: https://goo.gl/q6wRfA10/07 19:54
4F→: 把"pip3"改成"pip"10/03 23:01
6F→: 若還是跳出command not found ,就先安裝pip:10/03 23:02
7F→: sudo easy_install pip10/03 23:03
4F推: 順帶一提,想在python檔案內使用cmd,可用os.system()09/30 16:14
3F推: 長知識了,不過為什麼不用slice?(list[::-1])09/28 12:54
6F推: 謝謝指教,我還是coding新手沒有linked list的概念,09/30 12:56
7F→: 補充了一下背景知識,的確應該和__getitem__沒什麼關聯09/30 12:58
3F→: return多值,其型態即為Tuple,加不加括號都一樣09/27 10:24