write_csv.py 472 B

123456789101112131415161718
  1. import csv
  2. import os
  3. def logo_text(browser, url):
  4. browser.get(url)
  5. text = browser.find_element_by_class_name('logo-text').text.strip()
  6. print(text)
  7. def write_csv(data, order): # запись в csv
  8. path_f = os.path.dirname(os.path.abspath(__file__))
  9. with open(
  10. os.path.join(path_f, "students.csv"), "a", newline='', encoding='utf-8') as file_:
  11. writer_f = csv.DictWriter(file_, fieldnames=order)
  12. writer_f.writerow(data)