手机
当前位置:查字典教程网 >脚本专栏 >python >python通过正则查找微博@(at)用户的方法
python通过正则查找微博@(at)用户的方法
摘要:本文实例讲述了python通过正则查找微博@(at)用户的方法。分享给大家供大家参考。具体如下:这段代码用到了python正则的findal...

本文实例讲述了python通过正则查找微博@(at)用户的方法。分享给大家供大家参考。具体如下:

这段代码用到了python正则的findall方法,查找所有被@的用户,使用数组形式返回用户昵称

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

返回结果如下:

['dfugo', 'jb51']

希望本文所述对大家的Python程序设计有所帮助。

【python通过正则查找微博@(at)用户的方法】相关文章:

python list 合并连接字符串的方法

python两种遍历字典(dict)的方法比较

python迭代器的使用方法实例

Python中使用动态变量名的方法

python正则分组的应用

Python中使用中文的方法

python回调函数的使用方法

python中的yield使用方法

vc6编写python扩展的方法分享

python生成器的使用方法

精品推荐
分类导航