- くだすれPython(超初心者用) その23
808 :デフォルトの名無しさん[sage]:2014/07/23(水) 19:55:38.79 ID:zLpOunK4 - >>805
python3.3でだけど import re def m2s(m): try: r = chr(int(m.group(1), 10)) except: r = m.group(0) return r body = re.sub(r'&#(\d+);', m2s, body, flags=re.ASCII)
| - くだすれPython(超初心者用) その23
809 :デフォルトの名無しさん[sage]:2014/07/23(水) 20:19:14.22 ID:zLpOunK4 - >>807
たぶんこんなの a = [[1,2,3,4], [1,3,5,7], [2,9], [0,2,9]] b = [] s = set() for L in a: if len(s & set(L)) <= 1: b.append(L) s |= set(L) print(b)
|
|