Okay so I was not able to say properly. You are indeed doing the same thing that you were doing i.e. writting the modified data just, that now you don't need to close you if file before doing any writting stuff. That is there is a one line deduction from the whole code.
Souvik flutter dev On Sat, Apr 18, 2020, 1:20 PM Peter Otten <__pete...@web.de> wrote: > Souvik Dutta wrote: > > > You can actually read and write in a file simultaneously. Just replace > "r" > > with "w+" if the file has not been previously made or use "r+" is the > file > > has already been made. > > Good advice for those who like to butcher their data ;) > > Seriously, writing modified data into a new file is the cleaner and safer > method in most cases. > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list