title: simultaneous reading and writing to a file in python
body: <p>I am planning an application in python3 which makes use of either three text files or three database tables,am not sure what to use.These files consits of just strings or a single column in a database table with a string in each row.<br/><br/>
  The app has three programs program_A ,program_B ,program_C which manipulate these three files,file_A and file_B and file_C.Program A reads/writes file_A reads file_C and writes into file_B,program_B reads/writes file_B,program_C writes file_A and file_C.file_A and file_B are nothing but imaginary queue so a program reads a line from the file and then removes that line from the file,(hence i mentioned reads/writes) and a program that writes to a file writes a line to the end of the file.<br/><br/>
      I am not sure how i can get these programs to work since these programs are simultaneously accessing the files.I have looked into sqlite file locking states and i don't know how i can use it to solve my scenario.I am also not sure if i should be using sqlite databases or simple text files.<br/><br/>
      I am also considering using some kind of shared memory,or inmemory database where i can load the contents of these files when the app starts and writing back to the files when the app exits,but am worried if some software hardware failure would mean i would lose the work done on that run of the app since the files were not updated because of the failure.</p>