1
General Software Discussion / In Python 2.7. how do I Read in Specific Text From a File and Assign to Variable
« on: June 02, 2022, 10:44 PM »
Hello,
How do I read in text as string instead of an integer?
These lines are supposed to read in data as text, but all the values I get are these numbers (respectively)...
5628
5639
-1
5664
8795
The raw data from text file...
[SimVars.0]
Latitude=N21° 20' 47.36"
Longitude=W157° 27' 23.20"
What is wrong?
Thanks.
Calvin
How do I read in text as string instead of an integer?
Code: Python [Select]
- start = content.find("SimVars.0")
- latstart = content.find("Latitude=")
- latend = content.find("Latitude=",latstart+1)
- longstart = content.find("Longitude=",start)
- longend = content.find(",",longstart)
These lines are supposed to read in data as text, but all the values I get are these numbers (respectively)...
5628
5639
-1
5664
8795
The raw data from text file...
[SimVars.0]
Latitude=N21° 20' 47.36"
Longitude=W157° 27' 23.20"
What is wrong?
Thanks.
Calvin