Program gets a list of titles from a website. Then stored in a variable (listOfjobs). I want to be able to write the contents of that variable (a list of job positions) appending it to an existing text file, but it tells me that only strings are accepted. How can I include the printout of the values of listOfJobs as plain text in a text file? Thanks!
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('https://jobs.theguardian.com/searchjobs/?LocationId=1500&keywords=personal+assistant&radialtown=London+(Central)%2c+London+(Greater)&countrycode=GB')
elem = browser.find_elements_by_class_name('lister__header')
for el in elem:
listOfJobs = print(el.text)
print(listOfJobs)
import os
helloFile = open('C:\\Users\\sk\\PycharmProjects\\test\\test_email.txt', 'w')
helloFile.write(websiteText)
helloFile.close()