作者查詢 / funnyPeter

總覽項目: 發文 | 留言 | 暱稱
作者 funnyPeter 在 PTT [ Python ] 看板的留言(推文), 共83則
限定看板:Python
看板排序:
全部Gossiping353SENIORHIGH156StoneAge151Physics143Python83NDS66Browsers46japanavgirls44graduate38NSwitch35WomenTalk30Hunter29Gamesale25JOJO20Boy-Girl19CVS17StupidClown17BBSmovie14FuMouDiscuss14joke14Nintendo14EZsoft13Math13MuscleBeach13wisdom13CCRomance12java12Examination9Disabled8sex8Suckcomic8PublicIssue7cat6LoL6PSP-PSV6ShowOff6Beauty5DummyHistory5FTV5movie5PttNewhand5share5Doraemon4MenTalk4NCU_Talk4PublicServan4Soft_Job4FCK-MOON3Key_Mou_Pad3KS98-3023NCHU-FS1003NCNUEM3SSSH-16th-Fk3talk3ASIA-uni2Chiayi2Eason2FCU_EE97B2FJU-Family2FongShan2HatePolitics2Hsinchu2JinYong2KS96-3182KS97-3102KTPS41th6102KUAS2NCCU_C-Baske2NTUIE972NUTN_BSC2PCCU_AM2PlayFootball2Shu-Lin2ShuangHe2SongShan2SSSH-16th3172TCFSHvolley2TigerBlue2toberich2Wanted2ACMCLUB1ascii_wanted1asciiart1ASHS-93-li1ASIA_ISA1ask1B97A013XX1Capricornus1CATCH1Catholic1Chinese1ck61st3051ck61st3121cksh85th3171CMU_M521CSMU-HSA961Desp_Housewi1DragonBall1Education1EYESHIELD211facelift1FJU-MBA961Fooyin1Gintama1GossipPicket1HarryPotter1HCU1HSNU_10321HSNU_11241HY-40-Xin1JP_Entertain1Kaohsiung1kartrider1KS_PMAC1Lineage1Little-Games1lizen34-6011marvel1Master_D1MCU_Talk1MKSH-95-61mud1NCCU_FHL1NCHU-AS1021NCHU-Cycling1NCHU-ENVE1021NCTU-CVLab1NDMC-N571NextTV1NKFUST1NKFUST-CCE901NKUTEE1NTHUTL971NTUHistory981NTUST-ECE1NUK_AC981pal1paranormal1part-time1PCman1PeopleSeries1prozac1PTGSH96-3161PushDoll1RockMetal1Salary1SFHS1soul1SSSH-03rd3111Steam1SuperStarAve1SYSOP1tajen1TFSHS62th3161TFSHS69th3141THU-P-Softbo1USC1WHS-8th3011WuLing50-3061YZU_Talk1<< 收起看板(160)
首頁
上一頁
1
下一頁
尾頁
[問題] 請問我想要不斷在資料夾讀檔
[ Python ]7 留言, 推噓總分: +3
作者: ianant - 發表於 2014/09/25 16:31(11年前)
4Ffunnypeter: 同樓上 你要的功能很簡單 是可以寫出來的09/25 20:58
[問題] 關於while跟break
[ Python ]37 留言, 推噓總分: +9
作者: ersfw4418 - 發表於 2014/05/16 15:14(11年前)
11Ffunnypeter:將輸入list化再分析05/16 20:21
12Ffunnypeter:黏在一起無法判斷,變list把它們分開,再判斷05/16 20:28
20Ffunnypeter:喔,都可以阿,你的寫法是比較不pythonic05/17 08:26
21Ffunnypeter:我是給另外一個方式來判斷,程式運作有很多種寫法05/17 08:29
22Ffunnypeter:data=list(data);for I in data;05/17 08:30
23Ffunnypeter:if I.isdigit() or I.isalpha():......else: .....05/17 08:32
[問題] 讀檔後存成Dictionary
[ Python ]18 留言, 推噓總分: +2
作者: harohepowegr - 發表於 2014/05/12 20:58(11年前)
6Ffunnypeter:可以阿,用pickle05/12 21:51
7Ffunnypeter:pickle可以存python的資料結構05/12 21:52
8Ffunnypeter:你可以寫一個pickle為主的class05/12 21:52
9Ffunnypeter:讀寫操作寫在method05/12 21:53
10Ffunnypeter:例如 class dic05/12 21:54
11Ffunnypeter:a=dic('filename','r')05/12 21:55
12Ffunnypeter:然後內部你用pickle打開05/12 21:55
13Ffunnypeter:其他讀寫merhod內部都用pickle幫你完成05/12 21:57
14Ffunnypeter:詳細自己去官網看說明,1小時就能完成05/12 21:58
[問題]不用for迴圈尋找陣列中只出現過一次的資料
[ Python ]33 留言, 推噓總分: +8
作者: sariel0322 - 發表於 2014/05/08 14:43(11年前)
21Ffunnypeter:不太可能不用for,就算沒有用for,函式內部也會用for05/08 21:56
22Ffunnypeter:b={}, for I in a, if not b.get(I,None)05/08 21:57
23Ffunnypeter:b[I]=1 else b[i]+=105/08 21:59
24Ffunnypeter:這樣只有一個for, 跟樓上用collections差不多05/08 22:00
想徵二個小時的家教
[ Python ]71 留言, 推噓總分: +13
作者: purestone - 發表於 2014/05/05 19:46(11年前)
19Ffunnypeter:我覺得python應該是目前最簡單好用的語言05/06 12:51
20Ffunnypeter:只是我之前寫過一年多的c,c++,bash05/06 12:52
21Ffunnypeter:所以我不能確定對於一個沒基礎的人,python是不是真的05/06 12:53
22Ffunnypeter:簡單05/06 12:53
23Ffunnypeter:但我覺得一開始就用python應該還是ok的05/06 12:54
24Ffunnypeter:pygame是給有基礎的人看的,原po可以找入門書來學py05/06 12:55
25Ffunnypeter:可以用python寫一個99乘法,生死遊戲,河內塔,老鼠走05/06 12:56
26Ffunnypeter:迷宮05/06 12:56
27Ffunnypeter:如果這些都沒問題,可以繼續寫class05/06 12:57
28Ffunnypeter:寫一個 point class和circle class05/06 12:58
29Ffunnypeter:都要有計算距離和週長的method05/06 12:59
30Ffunnypeter:如果能寫出來,就可以開始看pygame05/06 12:59
31Ffunnypeter:大概要2-3個月吧05/06 13:00
32Ffunnypeter:參考看看,加油05/06 13:00
33Ffunnypeter:至於linux,也嘗試用bash寫99乘法和生死遊戲 這兩個就好05/06 13:03
34Ffunnypeter:,如果會,那就算會linux了05/06 13:03
35Ffunnypeter:大概一個禮拜(學完python)05/06 13:03
40Ffunnypeter:我猜原po只是要在linux平台寫python05/06 13:21
41Ffunnypeter:這樣是不用到熟linux,會用就好05/06 13:22
48Ffunnypeter:如果他爽就ok阿,瓶頸到了自然會,也有能力找資料05/06 13:41
49Ffunnypeter:至少要讓他知道入門要怎麼做05/06 13:42
50Ffunnypeter:不然也不知道要學到什麼時候才能學pygame05/06 13:44
51Ffunnypeter:你說的是沒錯,但我自己並不欣賞嚴厲批評人,叫他去練05/06 13:48
52Ffunnypeter:練在來的回答05/06 13:48
53Ffunnypeter:說真的,就是不懂才會來問,不管問題是多麼簡單,多麼05/06 13:49
54Ffunnypeter:笨05/06 13:49
55Ffunnypeter:我覺得都要清楚而明確的回復,你覺得蠢可以不用理會05/06 13:51
[問題] 大型稀疏矩陣乘法
[ Python ]15 留言, 推噓總分: +5
作者: askia - 發表於 2014/05/02 23:06(11年前)
1Ffunnypeter:get the array size05/02 23:12
2Ffunnypeter:import numpy.zeros((rows,cols))05/02 23:12
3Ffunnypeter:write data,done.05/02 23:13
4Ffunnypeter:讀檔有兩種方法,文字模式和binary模式05/02 23:26
5Ffunnypeter:後者效率比較好,但有點難度,可以用struct.unpack讀05/02 23:27
6Ffunnypeter:文字模式很簡單,讀進去後,取三個數字一組,寫進numpy05/02 23:29
7Ffunnypeter:.zeros後再讀取下一組05/02 23:29
8Ffunnypeter:這其實只是一般file I/o問題,跟矩陣沒關聯05/02 23:30
10Ffunnypeter:如果有浮點數,記得指定dtype=numpy.float05/02 23:50
11Ffunnypeter:修正一下第二個推文:05/02 23:51
12Ffunnypeter:import numpy as np05/02 23:51
13Ffunnypeter:arr=np.zeros((rows,cols),dtype=np.float)05/02 23:52
[問題] 無法開啟
[ Python ]26 留言, 推噓總分: +7
作者: purestone - 發表於 2014/05/01 19:57(11年前)
1Ffunnypeter:use absolute path not relative path05/01 20:27
2Ffunnypeter:that's a common error05/01 20:28
3Ffunnypeter:try a absolute path such as ~/script/images/.png05/01 20:32
10Ffunnypeter:絕對路徑:最前面有/開始05/02 04:55
11Ffunnypeter:相對路徑沒有, 通常找不到是路徑設定錯誤05/02 04:56
12Ffunnypeter:改成絕對路徑就不會發生找不到路徑的情況05/02 04:57
13Ffunnypeter:~的意思是你的家目錄, /home/username05/02 04:58
14Ffunnypeter:~/script/images/.png 意思是/home/username/script/im05/02 05:00
15Ffunnypeter:ages/.png05/02 05:00
16Ffunnypeter:當然你要先mkdir建立該目錄05/02 05:01
17Ffunnypeter:路徑改成 我上述說的絕對路徑看看05/02 05:02
18Ffunnypeter:這是初學者常見的錯誤05/02 05:03
19Ffunnypeter:dude.png當然要移動到該目錄內05/02 05:05
20Ffunnypeter:username改成你的名字05/02 05:06
21Ffunnypeter:我這裡舉的路徑只是例子,你也可以用~/images/.png05/02 05:07
22Ffunnypeter:你試試看 cd~05/02 05:09
23Ffunnypeter:然後打pwd就知道了05/02 05:10
24Ffunnypeter:自己寫程式不要都照抄,要自己改環境變數,這是很常見05/02 05:11
25Ffunnypeter:的修改05/02 05:11
[問題] 初學者問一個粗淺的問題~
[ Python ]8 留言, 推噓總分: +1
作者: purestone - 發表於 2014/04/30 22:58(11年前)
6Ffunnypeter:範例跟實際情況有時候會不同05/01 07:36
7Ffunnypeter:例如版本不一樣就會不同,不然就是書寫錯05/01 07:36
[問題] CSV檔資料開根號
[ Python ]5 留言, 推噓總分: +2
作者: okmnji - 發表於 2014/04/30 18:37(11年前)
1Ffunnypeter:import math04/30 18:48
2Ffunnypeter:read data ,and write back ,easy04/30 18:48
3Ffunnypeter:read data by import csv04/30 18:49
首頁
上一頁
1
下一頁
尾頁