我triying从列表中删除,包含“@”从字符串中删除词与
string = "@THISISREMOVED @test2 @test3 @test4 a comment"
splitted = string.split()
for x in splitted:
if '@' in x:
splitted.remove(x)
string =' '.join(splitted)
print(string)
所有单词,并返回:
@test2 @test4 a comment
我想删除所有的话包含'@'不只是第一个,我该怎么做? 谢谢
你想从列表中删除,或做你想从字符串中删除? – juanchopanza
我收到一个字符串,所以..从列表 – Darcyys
这绝对没有意义。 – juanchopanza