NewPrj_kv.write("<Screen>:\n")
NewPrj_kv.write(" mesage: mesage\n")
NewPrj_kv.write(" \n")
NewPrj_kv.write(" canvas.before:\n")
NewPrj_kv.write(" Color:\n")
NewPrj_kv.write(" rgba: 1,1,1,1\n")
NewPrj_kv.write(" Rectangle:\n")
NewPrj_kv.write(" pos: self.pos\n")
NewPrj_kv.write(" size: self.size\n")
NewPrj_kv.write(" GridLayout:\n")
NewPrj_kv.write(" cols: 1\n")
NewPrj_kv.write(" rows: 1\n")
NewPrj_kv.write(" GridLayout:\n")
NewPrj_kv.write(" cols: 3\n")
NewPrj_kv.write(" rows: 1\n")
NewPrj_kv.write(" \n")
with open('tmp.txt', 'r') as NewPrj_kv:
lines = NewPrj_kv.readlines()
lines.insert(2, 'new line\n')
, удаляйте, через del lines[X]
и тдwith open('tmp.txt', 'w') as NewPrj_kv:
NewPrj_kv.writelines(lines)