# sed workaround, shamelessly stolen & modified
# from https://raw.githubusercontent.com/mahmoudadel2/pysed/master/pysed.py
def replace(oldstr, newstr, infile):
linelist = []
with open(infile) as f:
for item in f:
newitem = re.sub(oldstr, newstr, item)
linelist.append(newitem)
with open(infile, "w") as f:
f.truncate()
for line in linelist: f.writelines(line)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter