How to print from text file???using 2d list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to print from text file???using 2d list

phone, 200 car, 20 consider i have these data in a text file. and i want to print them as name quantity phone 200 car 20.. how can I print like this,??

8th Jan 2018, 2:36 PM
Niraz Tamang
Niraz Tamang - avatar
3 Answers
+ 5
What language?
8th Jan 2018, 2:56 PM
Hatsy Rei
Hatsy Rei - avatar
+ 5
There are probably better ways, but you could mess around with this: print("{:20}{:10}".format("Name", "Quantity")) print("{:20}{:10}".format("----", "--------")) with open("my_file.txt", "r") as file: for line in file: a, b = line.split(', ') print("{:20}{:10}".format(a, b))
10th Jan 2018, 3:32 AM
David Ashton
David Ashton - avatar
0
its python
8th Jan 2018, 3:03 PM
Niraz Tamang
Niraz Tamang - avatar