Question: python, printing a line from a file i need to open the file with a function ive made, i think ive got that, now i

python, printing a line from a file

i need to open the file with a function ive made, i think ive got that, now i want it to print just the first line

python, printing a line from a file i need to open the

In [1 def open_function (b) f-open(b, 'r for i in range (1): bbb - Notepad File Edit Format View Help testbline 1 line 2 line 3 first-line-f.readline() #### ???? is this not right??? rest-f.readlines() f.close In [2]: open function ("bbb.txt') print(first_line) Traceback (most recent call last) NameError python-input-2-8c6b9aaf22ad in --> 1 open-function (bbb.txt) () 2 print(first_line) NameError: name 'bbb' is not defined In

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!