Objective
Create a Python program that extracts the hashtags and the mentions from a message with re.findall.
Instructions
- Read a message.
- Get the hashtags with
re.findall(r"#\w+", message)and the mentions withre.findall(r"@\w+", message). - On the first line show
Hashtags:followed by the hashtags separated by a space, in the order in which they appear. If there are none, showHashtags: -. - On the second line show
Mentions:with the same format.
Hola @ana, mira esto #python #codigo con @luis
Hashtags: #python #codigo
Mentions: @ana @luis
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise