How to Insert/Copy content from One Html File to Other HTML File
How to Insert/Copy content from One Html File to Other HTML File
os.path.join(os.getcwd()) -> this will ge curent working directory path
(sample HTML file content) content = '''<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>test</title>
<style>*{ margin: 0; padding: 0; width: 360px!important; max-width: 360px !important; }
</style>
</head>
<body>
<div>
<p>hello , This is paragraph content for testing purpose only</p>
<script>
</script>
<blockquote class="twitter-tweet" lang="en">
<a href="https://twitter.com/faniskoengage/status/1303453019204452352"></a>
</blockquote>
<script src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>Thanks</p>
</div>
</body>
</html>
'''
file_path = os.path.join(os.getcwd(), 'static\\demo.html')
with open(file_path, 'w') as p:
p.write(content)
reading binary of image
file_path = os.path.join(os.getcwd(), 'static\\demo.png')
with open(file_path, 'rb') as p:
bin_var = p.read()
Comments
Post a Comment