I am quite new to programming. I want to read a data file and store it as a 2d Array in python3 so that I can operate on the single elements. I am using the following method to read in the file:
with open("text.txt", "r") as text:
lines = [line.split() for line in text]
This however parses everything as text. How can I read in a file whilst maintaining the data types (text parsing as text, ints as ints and floats as floats, etc)? The input file looks something like this:
HNUS 4973168.840 1734085.512 -3585434.051
PRET 5064032.237 2724721.031 -2752950.762
RBAY 4739765.776 2970758.460 -3054077.535
TDOU 5064840.815 2969624.535 -2485109.939
ULDI 4796680.897 2930311.589 -3005435.714