def push_list_from_clipboard():
push_type_dict = {
u"?": 1,
u"?": 2,
u"\u2192": 3
}
def construct_push(line):
words = line.split(' ')
if len(words) < 2:
return None
push = re.sub('\\s', '', words[0])
if push not in push_type_dict:
return None
push = push_type_dict[push]
u_id = re.sub('\\s', '', words[1])
if u_id[-1] != ':':
return None
u_id = re.sub(':', '', u_id).encode('ascii')
return {'push': push, 'id': u_id}
content = pyperclip.paste()
lines = re.split('\r\n|\r|\n', content)
return [x for x in map(construct_push, lines) if x]
评论列表
文章目录