class Solution(object):
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
kv_dict = {'{': '}', '(': ')', '[': ']'}
data_list = []
for i in range(len(s)):
c = s[i]
if c in kv_dict.keys():
data_list.append(c)
elif c in kv_dict.values():
if len(data_list) == 0 or c != kv_dict[data_list.pop()]:
return False
if(len(data_list) > 0):
return False
return True