Introduction
In this project, you will learn how to extract usernames from text using Python. This is a common task in social media and instant messaging applications, where the @
character is often used to mention someone.
ð Preview
## Example 1
>>> from parse_username import after_at
>>> text = "@LabEx @labex I won in the @ competition"
>>> print(after_at(text))
['LabEx', 'labex']
## Example 2
>>> text = "@LabEx@labex I won in the @ competition"
>>> print(after_at(text))
['LabEx', 'labex']
## Example 3
>>> text = "@labex @LabEx I won in the @LabEx competition"
>>> print(after_at(text))
['LabEx', 'labex']
## Example 4
>>> text = "@!LabEx @labex I won in the competition"
>>> print(after_at(text))
['labex']
## Example 5
>>> text = "I won in the competition@"
>>> print(after_at(text))
[]
## Example 6
>>> text = "LabEx@!"
>>> print(after_at(text))
[]
## Example 7
>>> text = "@!@LabEx @labex I won in the @LabEx competition @experiment"
>>> print(after_at(text))
['LabEx', 'experiment', 'labex']
ðŊ Tasks
In this project, you will learn:
- How to implement the
after_at
function to extract usernames from a given text - How to handle edge cases and optimize the performance of the function
- How to test the function with various input scenarios
ð Achievements
After completing this project, you will be able to:
- Understand how to use Python to parse and extract relevant information from text
- Develop a robust and efficient function to extract usernames from text
- Apply your problem-solving skills to enhance the functionality of the function
- Test your code thoroughly to ensure it works as expected