Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

heres bbb.txt in case you want to try it test b line 1 1,2,3,4,5,6,7,8 55,0,90,09,1,2,3, 8,9,7,6,8,7,6 3,43,5,8,2,4,1 .im making a function that can open a

heres bbb.txt in case you want to try it

test b line 1 1,2,3,4,5,6,7,8 55,0,90,09,1,2,3, 8,9,7,6,8,7,6 3,43,5,8,2,4,1

.im making a function that can open a text file and seperate the first line from all the rest.

question at the bottom

image text in transcribed

C Code bbb - Notepad File Edit Format View Help In [3] def mi_func(P): bfirst line 1 f-open(P, '' first f.readline() rest- f.readlines() rest = [l. Split(',') for i in rest] return first, rest 1,2,3,4,5,6,7,8 55,0,90,09,1,2,3, 8,9,7,6,8,7,6 3,43,5,8,2,4,1 - bvalues f.close [18] : afirst,avalues = mi.func('aaa.txt') bfirst,bvalues mi_func ('bbb.txt') In print (bvalues) ['1', "2', "3', '4', '5', 6', 7", 8In'], ['55 '], '776']] 1)why does it only print first line and 55 on bvalues? 2) how does it get 776? 3) how can i make it print bvalues properly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

What are the purposes of promotion ?

Answered: 1 week ago