Python HackerRank|DefaultDict Tutorial(from collections import defaultdict)
2017-03-06 18:54
549 查看
Dashboard
Python
Collections
DefaultDict
Tutorial
Python
Collections
DefaultDict
Tutorial
from collections import defaultdict n, m = list(map(int, input().split())) d = defaultdict(list) for i in range(1,n+1): d[input()].append(i) for _ in range(m): char = input() if char in d: print(*d[char]) else: print(-1)
相关文章推荐
- Python HackerRank|Collections.namedtuple(from collections import namedtuple)
- Python HackerRank|Word Order(OrderedCounter)(from collections import Counter, OrderedDict)
- Python HackerRank|Collections.deque()(from collections import deque)
- Python HackerRank|Piling Up!(from collections import deque)
- Python HackerRank|Time Delta(from datetime import datetime)
- Python HackerRank|Maximize It!(from itertools import product)
- hackerrank DefaultDict Tutorial
- Python 3 collections.defaultdict() 与 dict的使用和区别
- python collections defaultdict
- 简介Python的collections模块中defaultdict类型的用法
- Python collections.defaultdict()与dict的使用和区别
- Python: dict setdault函数与collections.defaultdict()的区别
- Python学习笔记(三十三)常用内置模块(2)collections_namedtuple_deque_defaultdict_OrderedDict_Counter
- Python collections.defaultdict() 与 dict的使用和区别
- 解决python中问题AttributeError: 'collections.defaultdict' object has no attribute 'iteritems'
- python from collections import namedtuple
- python中collections 模块里的defaultdict()函数
- python学习笔记-Day03 -第一部分(collections,Counter,defaultdict,namedtuple)
- Python collections.defaultdict()
- Python collections.defaultdict 笔记