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
Skills Graph
%%%%{init: {'theme':'neutral'}}%%%%
flowchart RL
python(("`Python`")) -.-> python/BasicConceptsGroup(["`Basic Concepts`"])
python(("`Python`")) -.-> python/ControlFlowGroup(["`Control Flow`"])
python(("`Python`")) -.-> python/DataStructuresGroup(["`Data Structures`"])
python(("`Python`")) -.-> python/FunctionsGroup(["`Functions`"])
python(("`Python`")) -.-> python/ModulesandPackagesGroup(["`Modules and Packages`"])
python(("`Python`")) -.-> python/AdvancedTopicsGroup(["`Advanced Topics`"])
python(("`Python`")) -.-> python/PythonStandardLibraryGroup(["`Python Standard Library`"])
python/BasicConceptsGroup -.-> python/comments("`Comments`")
python/BasicConceptsGroup -.-> python/variables_data_types("`Variables and Data Types`")
python/BasicConceptsGroup -.-> python/booleans("`Booleans`")
python/ControlFlowGroup -.-> python/conditional_statements("`Conditional Statements`")
python/ControlFlowGroup -.-> python/for_loops("`For Loops`")
python/ControlFlowGroup -.-> python/while_loops("`While Loops`")
python/ControlFlowGroup -.-> python/break_continue("`Break and Continue`")
python/DataStructuresGroup -.-> python/lists("`Lists`")
python/DataStructuresGroup -.-> python/tuples("`Tuples`")
python/FunctionsGroup -.-> python/function_definition("`Function Definition`")
python/FunctionsGroup -.-> python/lambda_functions("`Lambda Functions`")
python/ModulesandPackagesGroup -.-> python/importing_modules("`Importing Modules`")
python/ModulesandPackagesGroup -.-> python/using_packages("`Using Packages`")
python/AdvancedTopicsGroup -.-> python/iterators("`Iterators`")
python/AdvancedTopicsGroup -.-> python/decorators("`Decorators`")
python/PythonStandardLibraryGroup -.-> python/data_collections("`Data Collections`")
python/BasicConceptsGroup -.-> python/python_shell("`Python Shell`")
python/FunctionsGroup -.-> python/build_in_functions("`Build-in Functions`")
subgraph Lab Skills
python/comments -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/variables_data_types -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/booleans -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/conditional_statements -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/for_loops -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/while_loops -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/break_continue -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/lists -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/tuples -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/function_definition -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/lambda_functions -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/importing_modules -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/using_packages -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/iterators -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/decorators -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/data_collections -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/python_shell -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
python/build_in_functions -.-> lab-302751{{"`Extract Usernames from Text with Python`"}}
end