Вечер добрый. Надо до завтра решать пару задач в pyschools и столкнулся с 1 проблемой где час не могу решать её. Может есть те кто когда-то делали на pyschools и знают что до как ? Скрин задачи : https://imgur.com/oqsXd7T Пробовал пару вариантов и толк 0.
IEscobaro, попробуйте вместо rstrip read().splitlines() --- Сообщение объединено с предыдущим 3 дек 2019 Не гарантирую 100% работу, но попробовать можно
Закрыто: # Write a function to read a CSV file with ',' as delimiter and returns a list of records. # The function must be able to ignore ',' that are within a pair of double quotes '"'. import csv def csvReader(filename): records = [] with open(filename,'r') as f: csv_reader = csv.reader(f,delimiter = ',') for line in csv_reader: if line=='': continue # ignore empty line records.append(line) return records Код # Write a function to read a CSV file with ',' as delimiter and returns a list of records. # The function must be able to ignore ',' that are within a pair of double quotes '"'. import csv def csvReader(filename): records = [] with open(filename,'r') as f: csv_reader = csv.reader(f,delimiter = ',') for line in csv_reader: if line=='': continue # ignore empty line records.append(line) return records Код который работает, может кому-то потом поможет)