Step 1
Whenever you're tackling a new project, it can be tempting to dive right into writing code. But more often than not, It's best to take a step and consider the bigger picture. I recommend first drawing up a high-level plan for what your program needs to do. Don't think about the actual code yet - you can worry about that later. Right now, stick to broad strokes.
For example, your phone and email address extractor project will need to do the following:
- Get the text off the clipboard.
- Find all phone numbers and email addresses in the text.
- Paste them onto the clipboard.
Step 2
Now you can start thinking about how think might work in code. the code will need to do the following:
- Use the pyperclip module to copy and paste strings.
- Create two regexes, one for matching phone numbers and the other for matching email addresses.
- Neatly format the matched strings into a single string to paste.
- Display some kind of message if no matches were found in the text.
Top comments (0)