Re: [問題] word count in files
※ 引述《azulazure (獨在異鄉為異客)》之銘言:
(deleted)
: I tried to use range function to do the work, but it didn't work.
: I wrote like this (following what I had above):
: for x in range(wordcount):
: if x in range(wordcount - 1) == False:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
此行有誤
可改成: if (x in range(wordcount - 1) == False:
或是: if x not in range(wordcount - 1):
: print x
: When I ran it, nothing happened. Can anyone tell me what's wrong?
: Or is there a better way to do it?
: My logic is that if the number is larger than the max number -1,
: it should be the largest number.
: Thanks in advance for any help!
何不直接印出max number (print wordcount) ?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.207.64
推
02/25 06:46, , 1F
02/25 06:46, 1F
→
02/25 06:47, , 2F
02/25 06:47, 2F
→
02/25 06:48, , 3F
02/25 06:48, 3F
→
02/25 06:48, , 4F
02/25 06:48, 4F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 3 篇):
Python 近期熱門文章
PTT數位生活區 即時熱門文章