import re s = ''' {"type":"buy","order_no":"2020061613141386691649969"} ''' ret = re.search(r'"type":"(.*?)"', s) print(ret.group()) print(ret.group(0)) print(ret.group(1))