Эта программа должна анализировать номера учащихся и, если они верны, заносить их в один список, а если нет, записывать их в другой список. Они верны, если они состоят из восьми цифр и содержат только цифры.
Однако я понятия не имею, что вводить, когда дело доходит до части try и кроме.
Если кто-нибудь сможет помочь, буду очень признателен!
Valid_file = "ValidNumbers.txt"
Invalid_file = "InvalidNumbers.txt"
Data_file = "Data.txt"
def analyse_students(Data_file):
lenth = len(Data_file)
total = 0
try:
except:
return 0
def read(Data_file):
count = 0
student_list = []
try:
open(Data_file)
except:
print("Couldn't append file", Valid_file)
return count, student_list
def write(student, status):
if status:
try:
open(Data_file)
except:
print("Couldn't append file", Invalid_file)
count, student_list = read(Data_file)
print("Number of lines read", count)
for student in student_list:
print("See output files")
Подробнее здесь: https://stackoverflow.com/questions/620 ... -in-python