fork download
  1. #!/usr/bin/env python3
  2.  
  3. html_lines ="\
  4. <!DOCTYPE html>\n\
  5. <html lang=\"ja\">\n\
  6. <head>\n\
  7. <meta charset =\"UTF-8\">\n\
  8. <title>タイトル</title>\n\
  9. </head>\n\
  10. <body>\n\
  11. Hello HTML!\n\
  12. </body>\n\
  13. </html>\n\
  14. "
  15.  
  16. if __name__ == '__main__':
  17. with open('output.html', 'w', encoding = 'utf-8') as f:
  18. f.writelines(html_lines)
  19. print("HTML file 'output.html' has been written successfully.")
  20.  
Runtime error #stdin #stdout #stderr 0.16s 25712KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 17, in <module>
PermissionError: [Errno 13] Permission denied: 'output.html'