What is equivalent of open "Data.txt" for input as #1 Input #1, var1, var2, var3, ....... Input #1, var5, var9. ..in py | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is equivalent of open "Data.txt" for input as #1 Input #1, var1, var2, var3, ....... Input #1, var5, var9. ..in py

Python equivalent

11th Feb 2017, 3:32 AM
SHIRISH SHIROOR
SHIRISH SHIROOR - avatar
4 Answers
+ 2
SoloLearn Python Course --> Exceptions & Files --> Opening Files --> Reading Files --> Writing Files --> Working with Files ( you've completed a lot of courses, among which the Python one... but it seem's that you do it too quickly ^^ )
11th Feb 2017, 6:12 AM
visph
visph - avatar
+ 2
Course say: file = open("filename.txt", "r") cont = file.read() print(cont) file.close() Well, instead of output the 'cont' var, parse it by yourself to get yours values ^^ And if you need more, look at documentations: you'll find easily that exists too a readlines() method, and a split() method ( of strings, this one ) or others existing useful features to achieve your goal... but no such function wich is enough accuratly working in same behaviour than Qbasic directly...
11th Feb 2017, 7:14 AM
visph
visph - avatar
0
Any Answers
11th Feb 2017, 5:38 AM
SHIRISH SHIROOR
SHIRISH SHIROOR - avatar
0
In quick basic each variable is assigned a data from file. for eg. Read( or input#1) Breadth , length, Height Read Dia, Apex, span Data 15.2, 15.7, 23.8, 56.0, Logo, six _ months This will assign Breadth = 15.2 and span as six_months In data file 15.2 15.7 23.8 56.0 Logo six _ months I hope u understand my q
11th Feb 2017, 6:45 AM
SHIRISH SHIROOR
SHIRISH SHIROOR - avatar