看板 Python 關於我們 聯絡資訊
hi 我是Bob 第一次在這邊發文,聽說有不少高手臥虎藏龍! as title 我爬蟲了一個網站,經過整理得到很多如下面的結果 ['spanish', 'web2.0', 'e-learning', 'education', 'social', 'spain', 'tools', 'learning', 'google', 'e-learning2.0'] ['education', 'technology', 'learning', 'classroom', '%22educational%20technology%22', 'google', 'teaching', 'collaboration', 'students', 'web2.0'] [education] [technology] 每一個list就是一個人所收藏的標籤,像是a桑收藏第一行的list標籤集,b桑收藏第二行的標籤集等,有很多筆list。 我想請問,要如何計算與判斷同時收藏education標籤與technology的人數,以及要如行計算與判斷收藏education或收藏technology的人數 我一開始是打算先指定一個標籤education,再使用if判斷是否與目標technology同時出現,可是考慮到人數就又感覺到怪怪的 請大家給我一點提示! 謝謝 -- Sent from my Windows -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.161.116.53 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1453135255.A.246.html
ocean5566: PYTHON不是有內建SET? 01/19 01:13
eight0: https://ideone.com/rluGId 01/19 03:09
Falldog: 直接存成set處理就好 不要存成list 01/19 16:57
alex0914: 塞進 sql. 咦這是 python 版 01/19 23:19
dnk4: \“計算與判斷收藏education或收藏technology的人數” 這 01/26 23:24
dnk4: 用 Counter() 應該能解決? 01/26 23:24