Replace line | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Replace line

I want to write a program in python that give me some data and then save them in one file.How to change the value in line 12?for example 14 to 24. code: f=open(

12th May 2018, 5:02 PM
mohamadamin baniasadi
mohamadamin baniasadi - avatar
1 Answer
+ 3
The easiest would be to combine readlines and writelines, if you just want to replace specific lines, leaving all others intact. But could you first share your code so we could see exactly what the task is?
12th May 2018, 7:49 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar