반응형

모두 집세를 내야 하기 때문에 아이들에게 코딩을 가르치고 있습니다.me teaching my kids coding because everyone must pay rent 

반응형
반응형

[python] How to write to an HTML file in Python

https://www.kite.com/python/answers/how-to-write-to-an-html-file-in-python

 

Kite - Free AI Coding Assistant and Code Auto-Complete Plugin

Code faster with Kite’s AI-powered autocomplete plugin for over 16 programming languages and 16 IDEs, featuring Multi-Line Completions. Works 100% locally.

www.kite.com

USE open() AND file.write() TO WRITE TO AN HTML FILE

Use open(file, mode) with mode as "w" to create a new HTML file file or write to an existing one. Use file.write(data) to write data to the file. Use file.close() to close the file after writing.

text = '''
<html>
    <body>
        <h1>Heading</h1>
    </body>
</html>
'''
file = open("sample.html","w")
file.write(text)
file.close()
SAMPLE.HTML
<html>
    <body>
        <h1>Heading</h1>
    </body>
</html>
반응형
반응형
반응형
반응형
생활코딩 오프라인 수업 라이브 - 작심40시간


https://opentutorials.org/module/696










...

반응형

+ Recent posts