I wrote one program which help inrementing the digit in the file. Able to copy only first line if I am using writelines and for f.write I am getting
f.write(new_lin e ) if lines[0].strip().endswi th(':') else f.write([new_line, *lines]) TypeError: write() argument must be str, not list

file.txt

Django 2.1:0
djangoAPI
My Code

import re
regex = r'(?<=:)\d*$'
def incr_patch_vers ion(fname):...