[問題] 有趣的問題 關於交集與聯集的處理方式

看板Python作者 (busystudent)時間8年前 (2016/01/19 00:40), 編輯推噓3(303)
留言6則, 5人參與, 最新討論串1/3 (看更多)
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

01/19 01:13, , 1F
PYTHON不是有內建SET?
01/19 01:13, 1F

01/19 03:09, , 2F

01/19 16:57, , 3F
直接存成set處理就好 不要存成list
01/19 16:57, 3F

01/19 23:19, , 4F
塞進 sql. 咦這是 python 版
01/19 23:19, 4F

01/26 23:24, , 5F
\“計算與判斷收藏education或收藏technology的人數” 這
01/26 23:24, 5F

01/26 23:24, , 6F
用 Counter() 應該能解決?
01/26 23:24, 6F
文章代碼(AID): #1MdHMN96 (Python)
討論串 (同標題文章)
文章代碼(AID): #1MdHMN96 (Python)