#!/usr/bin/env python3
import subprocess, sys
html_lines ="\
<!DOCTYPE html>\n\
<html lang=\"ja\">\n\
<head>\n\
<meta charset =\"UTF-8\">\n\
<title>タイトル</title>\n\
</head>\n\
<body>\n\
Hello HTML!\n\
</body>\n\
</html>\n\
"
# 使用するブラウザ例
browsers = {'w3m': 'w3m',
'firefox': 'firefox',
'vivaldi': 'vivaldi'}
if __name__ == '__main__':
with open('output.html', 'w') as f:
f.writelines(html_lines)
print("HTML file 'output.html' has been written successfully.")
# ここでブラウザを起動し、生成したHTMLファイルに適用する
subprocess.run([browsers['w3m' if len(sys.argv) == 1
else sys.argv[1].lower()],
'output.html'])
IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwoKaW1wb3J0IHN1YnByb2Nlc3MsIHN5cwoKaHRtbF9saW5lcyA9IlwKPCFET0NUWVBFIGh0bWw+XG5cCjxodG1sIGxhbmc9XCJqYVwiPlxuXAogICAgPGhlYWQ+XG5cCiAgICAgICAgPG1ldGEgY2hhcnNldCA9XCJVVEYtOFwiPlxuXAogICAgICAgIDx0aXRsZT7jgr/jgqTjg4jjg6s8L3RpdGxlPlxuXAogICAgPC9oZWFkPlxuXAogICAgPGJvZHk+XG5cCiAgICAgICAgSGVsbG8gSFRNTCFcblwKICAgIDwvYm9keT5cblwKPC9odG1sPlxuXAoiCgojIOS9v+eUqOOBmeOCi+ODluODqeOCpuOCtuS+iwpicm93c2VycyA9IHsndzNtJzogJ3czbScsCiAgICAgICAgICAgICdmaXJlZm94JzogJ2ZpcmVmb3gnLAogICAgICAgICAgICAndml2YWxkaSc6ICd2aXZhbGRpJ30KCmlmIF9fbmFtZV9fID09ICdfX21haW5fXyc6CiAgICB3aXRoIG9wZW4oJ291dHB1dC5odG1sJywgJ3cnKSBhcyBmOgogICAgICAgIGYud3JpdGVsaW5lcyhodG1sX2xpbmVzKQogICAgcHJpbnQoIkhUTUwgZmlsZSAnb3V0cHV0Lmh0bWwnIGhhcyBiZWVuIHdyaXR0ZW4gc3VjY2Vzc2Z1bGx5LiIpCiAgICAjIOOBk+OBk+OBp+ODluODqeOCpuOCtuOCkui1t+WLleOBl+OAgeeUn+aIkOOBl+OBn0hUTUzjg5XjgqHjgqTjg6vjgavpgannlKjjgZnjgosKICAgIHN1YnByb2Nlc3MucnVuKFticm93c2Vyc1sndzNtJyBpZiBsZW4oc3lzLmFyZ3YpID09IDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHN5cy5hcmd2WzFdLmxvd2VyKCldLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvdXRwdXQuaHRtbCddKQo=