I would create a dictionary, set or list from the file data with the values converted. That is not required, but it is my preference. I want to do the work necessary on import to make the data readily available.
Most of the experienced developers follow the same approach ,and I hope it is a best practice also.
But performance wise which is best way of doing.
Prepare the data in the begining itself by converting ,so that it will be easy for us to do any data manipulation.And no need to think in the middle of the application development ,whether the data is string or int or etc. we will know that our data has converted in the correct format.
Otherwise we will get confused when we get different results,and we have to check for each value,whether it is string or other datatype,with "print" out statements.
Once I faced the problem .when I am passing the ID as "int" to the method.Thinking that I have converted the ID from 'string' to 'int'.When i was struggling for longer time, and after anlayizing the data I came to know that one data type is in "string" format and the input data what i am passing is "int" format
Thanks
PSB