I'm a complete beginner in python... I wrote a simple script that pulls some data from a website and saves it to a text file, but after running the script it just sits there and doesn't "terminate". Since I'll be running it as a windows task I need it close on its own after running. Is there a way to tell python to close the terminal after the script finishes? I've looked everywhere and it seems that most people are trying to do the opposite, keep it open after the code runs. Not sure if it matters but I'm just running the .py file, not in VS or PyCharm. Thanks in advance.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from datetime import date
driver = webdriver.Chrome()
driver.get("MyURL")
time.sleep(11)
first = driver.find_element_by_xpath('/html/body/main/div[2]/div/div/div/div[2]/div[1]/div/div[2]/div[2]/div/ul/table/tbody/tr[3]/td[2]/div/span[1]')
second = driver.find_element_by_xpath('/html/body/main/div[2]/div/div/div/div[2]/div[1]/div/div[2]/div[2]/div/ul/table/tbody/tr[2]/td[2]/div/span[1]')
third = driver.find_element_by_xpath('/html/body/main/div[2]/div/div/div/div[2]/div[1]/div/div[2]/div[2]/div/ul/table/tbody/tr[1]/td[2]/div/span[1]')
first = first.text
second = second.text
third = third.text
print(first, second, third)
today = date.today()
today1 = today.strftime('%b %d %Y')
list = (today1, first, second, third)
print(list)
file = open('test.txt', 'a')
file.write(today1)
file.write(' ')
file.write(first)
file.write(' ')
file.write(second)
file.write(' ')
file.write(third)
file.write('\n')
file.close()
driver.close()