subject

The function below tries to create a list of integers by reading them from a file. The file is expected to have a single integer per line and the code works correctly in that case. If any of the lines don't contain just an integer, than this code fails. Fix this code so that it ignores any lines that don't contain integers instead of raising an exception. Do this with try/except blocks. Your code should still return the list of integers from the lines that contain integers. student. py 1- def get list of_integers from_file(filename): int list - for line in open(filename).readlines (): int list. append (int (line)) return int list 12

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:40
Hello my name is mihai and i need your : )i have to do a python project in computer science and i’m really busy with my mocks this period of time besides this i’m not good at coding so could someone pls pls pls sort me out ? i actually beg ; ))
Answers: 1
question
Computers and Technology, 22.06.2019 11:40
Pthreads programming: create and terminate a thread write a c++ program that creates a thread. the main will display a message “hello world from the main”. the main will create a thread that will display a message “hello world from the thread” and then terminates with a call to pthread_exit()
Answers: 3
question
Computers and Technology, 23.06.2019 08:00
The managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an .
Answers: 3
question
Computers and Technology, 24.06.2019 10:20
Identify the publisher in this citation: carter,alan.a guide to entrepreneurship.new york: river’2008.print.
Answers: 3
You know the right answer?
The function below tries to create a list of integers by reading them from a file. The file is expec...
Questions
question
Health, 13.07.2019 13:30
question
Mathematics, 13.07.2019 13:30
question
Mathematics, 13.07.2019 13:30
question
Mathematics, 13.07.2019 13:30
question
Mathematics, 13.07.2019 13:30
question
Mathematics, 13.07.2019 13:30