您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

retain_counts.py 372B

12345678910111213141516
  1. import re
  2. from typing import List
  3. from million.model.message import Message
  4. def retain_counts(messages : List[Message])-> List[Message]:
  5. """
  6. Retain only the messages that have a content and a sender_name
  7. """
  8. return [
  9. m for m in messages
  10. if m.content and
  11. m.sender_name and
  12. re.search('(\d{2,}|^\d$)', m.content)
  13. ]