Amit Dhamu

Software Developer

Write File Contents in Python

with open("index.html", "w") as w:
    w.write("""\
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Homepage</title>
    </head>
    <body>
        <h1>Hello</h1>
    </body>
</html>
""")


python / files / heredoc

← Force Delete iCloud Account on macOS Test /etc/fstab →

comments powered by Disqus