看板 [ Python ]
討論串[問題] 如何判別不同字個數
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 1→)留言1則,0人參與, 最新作者a0954153 (卓)時間14年前 (2011/07/13 12:27), 編輯資訊
0
0
0
內容預覽:
恩恩,我把它改成了這樣不知道會不會好一點. t=open(r'C:\_____.txt'). G=t.readlines(). K=set(). for i in range(len(G)):. G[i]=G[i].replace(',',' ').replace('.',' ').replace(
(還有5個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者timTan (用口頭禪區分年記)時間14年前 (2011/07/13 01:29), 編輯資訊
0
0
0
內容預覽:
print len(set( "i am a pig pig pig pig".split() )). --. 你怎麼會用到string 這個module?. --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 61.62.8.191.

推噓0(0推 0噓 5→)留言5則,0人參與, 最新作者a0954153 (卓)時間14年前 (2011/07/13 00:17), 編輯資訊
0
0
0
內容預覽:
就是例如 有一個 test.txt , 裡面是一篇文章. test.txt內容如下: i am a pig pig pig pig. 則 判別出 4. 有四個不同的單字. 我只有想到這樣做,. import string. t=open('test.txt'). G={}. a=string.spl
首頁
上一頁
1
下一頁
尾頁