How to read a input of numbers from a file colum wise | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to read a input of numbers from a file colum wise

for Eg if I/p is 2 1 3 4 6 the o/p must be 2 1 4

17th Mar 2017, 3:42 PM
PARTHIPAN SURYA
PARTHIPAN SURYA - avatar
2 Answers
0
split file into list of lines, then read line[0] in each otem/line. that's in general but notice it also depends alot on user requirements.
17th Mar 2017, 3:48 PM
Mohamed Salah
Mohamed Salah - avatar
0
import sys file = open("path_you_file") while file: line = file.readline() print(line[0]) # if it is good, like my code)))
18th Mar 2017, 6:48 AM
Роман