How to read a file and store it a memory using python

I need to Read the master file, store the records into memory. Read the transaction file, check if the record exist in the memory. If record does not exist in the memory, it will write the record into output file.

I want to read the following file and store it in memory

emp_id emp_name manager_id department_name 1 A 0 CEO - Office 2 B 1 President - Office 3 C 1 President - Office 4 D 1 President - Office 5 E 2 IT 6 F 2 IT 7 G 2 IT 8 H 3 IT 9 I 3 IT 10 J 3 IT 11 K 5 IT 12 L 5 IT 13 M 5 IT 14 N 6 IT 15 O 6 IT 16 P 12 IT 17 Q 12 IT 18 R 12 IT 19 S 16 FINANCE 20 T 16 FINANCE


ANSWERS:


In general:

with open(file_name, 'r') as f:
    contents=f.read()

That read the entire file. Or,

with open(file_name, 'r') as f:
    for line in f:
        # process a line at a time

With more specifics, you will get a more specific answer.



 MORE:


 ? How do i make the numbers added to the numbers list apply to the indexes of the list of words without any numbers being skipped
 ? Python Pandas: choosing maximum length of string
 ? Python Pandas subsetting based on Dates
 ? Python Pandas subsetting based on Dates
 ? Python Pandas subsetting based on Dates
 ? Pandas: Use iterrows on Dataframe subset
 ? subset dataframe pandas timeseries
 ? python pandas - build subset based on column names
 ? Subset data from pandas
 ? Unable to subset Pandas dataframe