r/learnpython • • May 06 '21

What are some programming tools that every beginner programmer should know about?

Example, today I learned about Git and GitHub and it felt incredible.

480 Upvotes

190 comments sorted by

View all comments

139

u/BullCityPicker May 06 '21

'grep' for finding bits of code. (If you're on windows, download "AstroGrep").

Also, they're a pain to learn, but learn regular expressions.

1

u/Redbeardybeard May 06 '21

Can you elaborate?

1

u/[deleted] May 06 '21

Not op, but if you are asking about why learning regular expressions (regex) is so important, regular expressions help simply searching for text patterns. As an example, I was told to find all the phone numbers in a large document. My options were to read the whole document and hope I catch each phone number, control+f the document trying "(x" where x is a number 2-9, or use a regular expression:

pattern = r"((?\d\d\d-?\)?\s?-?\d\d\d\s?-?\d\d\d\d)"
text_data = filepath/filename
phone_numbers_found = []
for line in text_data:
    match = re.search(pattern, line)
    if match:
        phone_numbers_found.append(match.group())

This was supposed to be one of those "it will take you a couple of days" assignments, that got done in 2 minutes. I turned it in a couple of days later, but you know.