【发布时间】:2021-03-19 12:41:24
【问题描述】:
我有一个大文本文件(来自 discord 的消息日志,准备在 ML 中使用) 可以有这样的内容:
username1
@username2, whats up
username2
username1, im good, and username3 is also doing well
(唯一用户名的数量相对较少,因此我可以轻松手动查找替换它们,并且名称更真实且其中没有数字)
问题是,我需要删除这些行,其中只有username,仅此而已。
所以这里是
@username2, whats up
username1, im good, and username3 is also doing well
blackground : 我使用的库将每一行视为单独的文本,因此如果未删除,它会生成用户名,而不是消息,因为标题名称的剪切数量
更好的例子,取自实际文件:
adyos
He reacted to invitation
adyos
And by the way, basic nightbot commands are up
adyos
And...
Captain Lea Skywalker
MEE6 is better, adyos ????
例外:
He reacted to invitation
And by the way, basic nightbot commands are up
And...
MEE6 is better, adyos ????
【问题讨论】:
-
第二个示例的预期输出是什么?
-
如何区分用户名和其他文字?
-
Tim Biegeleisen : 编辑后发布 Toto : 我会手动查找和补充每个名字,最多有 10 个