Replace One Line of Multiline String In Python? -
i have multi-line string in python, , want replace specific line number of it. have loop goes through each line , increments line number 1, do when reach line need replace? suggestions?
yourstring = yourstring.split("\n") yourstring[lineyouwant] = edit yourstring = "\n".join(yourstring)
lineyouwant 0 indexed
Comments
Post a Comment