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,??
3 Answers
+ 5
What language?
+ 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))
0
its python