内容:
repin_count":617, "is_private":0, "extra":null, "orig_source":null, "tags":[], "board":{"board_id":2681393, "user_id":977900, "title":"UI", "description":"", "category_id":"web_app_icon", "seq":1, "pin_count":782, "follow_count":9084, "like_count":27, "created_at":1350360763, "updated_at":1577953282, "deleting":0, "is_private":0, "extra":null, "key":"4af0f60602b02b587d21d470e54feb584b8a24259322-bYTJnQ","pins":[{"pin_id":814738561, "user_id":977900, "board_id":2681393, "file_id":103415954, "file":{"bucket":"hbimg", "key":"4af0f60602b02b587d21d470e54feb584b8a24259322-bYTJnQ", "type":"image/png", "height":600, "width":800, "frames":1, "theme":"001414"}, "media_type":0, "source":"dribbble.com", "link":"https://dribbble.com/shots/2724065-City-Sunset", "raw_text":"City Sunset", "key":"4af0f60602b02b587d21d470e54feb584b8a24259322-bYTJnQ",
求大佬解决!!!谢谢
怎么取出下方key中的这个:4af0f60602b02b587d21d470e54feb584b8a24259322-bYTJnQ
"key":"4af0f60602b02b587d21d470e54feb584b8a24259322-bYTJnQ"
print(re.findall('"key":"(.*?)"',data))
print能输出data,但是就取不出来。
import re
pattern = re.compile(r'"key":"(.*?)"')
num1 = pattern.findall('repin_count":617, "is_private":0, "extra":null, "orig_source":null, "tags":[], "board":{"board_id":2681393, "user_id":977900, "title":"UI", "description":"", "category_id":"web_app_icon", "seq":1, "pin_count":782, "follow_count":9084, "like_count":27, "created_at":1350360763, "updated_at":1577953282, "deleting":0, "is_private":0, "extra":null, "key":"4af0f60602b02b587d21d470e54feb584b8a24259322-bYTJnQ","pins":[{"pin_id":814738561, "user_id":977900, "board_id":2681393, "file_id":103415954, "file":{"bucket":"hbimg", "key":"4af0f60602b02b587d21d470e54feb584b8a24259322-bYTJnQ", "type":"image/png", "height":600, "width":800, "frames":1, "theme":"001414"}, "media_type":0, "source":"dribbble.com", "link":"https://dribbble.com/shots/2724065-City-Sunset", "raw_text":"City Sunset", "key":"4af0f60602b02b587d21d470e54feb584b8a24259322-bYTJnQ",')
print(num1)