I was reading an article(https://www.techgeekbuzz.com/blog/how-to-read-emails-in-python/) that describes how to read emails using python, now its using _, before declaring a variable here is the code:
#modules
import imaplib
import email
#credentials
username ="codehundred100@gmail.com"
#generated app password
app_password= "aqwertyuiopasdfa"
# https://www.systoolsgroup.com/imap/
gmail_host= 'imap.gmail.com'
#set connection
mail = imaplib.IMAP4_SSL(gmail_host)
#login
mail.login(username, app_password)
#select inbox
mail.select("INBOX")
#select specific mails
_, selected_mails = mail.search(None, '(FROM "noreply@kaggle.com")')
#total number of mails from specific user
print("Total Messages from noreply@kaggle.com:" , len(selected_mails[0].split()))
for num in selected_mails[0].split():
    _, data = mail.fetch(num , '(RFC822)')
    _, bytes_data = data[0]
    #convert the byte data to message
    email_message = email.message_from_bytes(bytes_data)
    print("\n===========================================")
    #access data
    print("Subject: ",email_message["subject"])
    print("To:", email_message["to"])
    print("From: ",email_message["from"])
    print("Date: ",email_message["date"])
    for part in email_message.walk():
        if part.get_content_type()=="text/plain" or part.get_content_type()=="text/html":
            message = part.get_payload(decode=True)
            print("Message: \n", message.decode())
            print("==========================================\n")
            break
Why is _, used every-time I remove it, it gives an error so I just wanna know what it does.
Thanks!!
 
     
    