Добавлен метод pprint в классы JsonManager и CsvManager для показа содержимого вложеных переменых в читаемом формате
This commit is contained in:
+8
-1
@@ -1,8 +1,9 @@
|
|||||||
from selenium.webdriver.chrome.options import Options
|
from selenium.webdriver.chrome.options import Options
|
||||||
import requests
|
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
from pprint import pprint
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
import requests
|
||||||
import json
|
import json
|
||||||
import csv
|
import csv
|
||||||
|
|
||||||
@@ -15,6 +16,9 @@ class CsvManager:
|
|||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
self.delimiter = delimiter
|
self.delimiter = delimiter
|
||||||
|
|
||||||
|
def pprint(self, data:any):
|
||||||
|
pprint(data)
|
||||||
|
|
||||||
def writerow(self, file_path:str, mode:str, row:list):
|
def writerow(self, file_path:str, mode:str, row:list):
|
||||||
'''Записываем строку в csv файл'''
|
'''Записываем строку в csv файл'''
|
||||||
with open(file_path, mode=mode, newline=self.newline, encoding=self.encoding) as file:
|
with open(file_path, mode=mode, newline=self.newline, encoding=self.encoding) as file:
|
||||||
@@ -45,6 +49,9 @@ class JsonManager:
|
|||||||
def __init__(self, encoding:str='utf8'):
|
def __init__(self, encoding:str='utf8'):
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
|
|
||||||
|
def pprint(self, data:any):
|
||||||
|
pprint(data)
|
||||||
|
|
||||||
def load(self, pathToJsonFile:str):
|
def load(self, pathToJsonFile:str):
|
||||||
'''Получаем данные из json файла'''
|
'''Получаем данные из json файла'''
|
||||||
with open(pathToJsonFile, encoding=self.encoding) as jsonFile:
|
with open(pathToJsonFile, encoding=self.encoding) as jsonFile:
|
||||||
|
|||||||
Reference in New Issue
Block a user