Peer Review: EMAIL EXTRACTION

Email extract using negative indices

Kenny Hin
Jul 13, 2022

Real world use of negative indices: email extraction

With ALL gmail accounts ending in (9 char-) ‘@gmail.co’ — you can use the negative indices to extract “@gmails”

Line 1

Create email_ list with list of emails for extraction.

Line 4

Create empty list email_extract to store extracted emails.

Line 7

A for in loop will iterate through each item in the list (“emails” being the individual items).

Line 9–10 ** Important

IF items in emails possess the 9 characters starting from the letter “o” ([-1]) going backwards up to “@” ([-10]) == “@gmail.co” (negative index [-10::-1]) — Then it will append to email_extract

A great way to organize code.

--

--