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
4 Respuestas
+ 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 ^^ )
+ 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...
0
Any Answers
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