Python USES regular methods to find @of at users on twitter

  • 2020-04-02 14:39:24
  • OfStack

This article illustrates python's method of finding @(at) users of micro blogs through regular methods. Share with you for your reference. The details are as follows:

This code USES python's regular findall method, finds all the users being @, and returns the user's nickname as an array


import re
users = re.findall(r'@([u4e00-u9fa5w-]+)','nihao @dfugo @jb51 haha')
print(users)

The results are as follows:


['dfugo', 'jb51']

I hope this article has helped you with your Python programming.


Related articles: