一个HTML页面定制这里是我到目前为止的代码:我无法打开使用Python由于某种原因
import os
print("The Arkeyan Text to HTML Converter\n\n")
w = 1
while w == 1:
var1 = input("\n\nWhat would you like the title of your page to be? ")
var2 = input("\nCool! Okay, now what is the text you want inside the body? ")
align = input("\nHow would you like this to be aligned? (center, right or left) ")
background = input("\nFinally, what background colour would you like? (It has to be in RGB format). Press 9 for more info.")
if background == "9":
background = input("\nGo to http://www.w3schools.com/tags/ref_colorpicker.asp to get a colour value and enter it in here: ")
print("\n\nAll done! Here is your personalised code:\n\n")
code = print("<!Doctype html>\n\
<html>\n\
<head>\n\
<title>",var1,"</title>\n\
</head>\n\n\n\
<body bgcolor=\"",background,"\">\n\
<div align=\"",align,"\">\n\
<h1>",var1,"</h1><br>\n\
<p>",var2,"</p>\n\
</div>\n\
</body>\n\
</html>")
my_file = open("C:\output.html", "w")
my_file.write(str(code))
my_file.close()
os.system("C:\\output.html")
x = input("\n\nThank you for using this HTML convert tool. Would you like to generate another code? ")
if x == "yes":
print("\n\n==========UNDERGOING LOOP PROCESS==========\n")
elif x == "no":
print("\n\n==========BREAKING THE LOOP==========\n")
w = 2
else:
print("I don't understand you. Self-destruct sequence initaiated...")
exit()
else:
print("\n\nAll done! Here is your personalised code:\n\n")
code = print("<!Doctype html>\n\
<html>\n\
<head>\n\
<title>",var1,"</title>\n\
</head>\n\n\n\
<body bgcolor=\"",background,"\">\n\
<div align=\"",align,"\">\n\
<h1>",var1,"</h1><br>\n\
<p>",var2,"</p>\n\
</div>\n\
</body>\n\
</html>")
my_file = open("C:\output.html", "w")
my_file.write(str(code))
my_file.close()
os.system("C:\\output.html")
x = input("\n\nThank you for using this HTML convert tool. Would you like to generate another code? ")
if x == "yes":
print("\n\n==========UNDERGOING LOOP PROCESS==========\n")
elif x == "no":
print("\n\n==========BREAKING THE LOOP==========\n")
w = 2
else:
print("I don't understand you. Self-destruct sequence initaiated...")
exit()
HTML页面被打开了罚款,但它说“没有”!这是为什么?我已经检查了好几次,似乎无法解决问题。你可以帮我吗?附:我需要很快修复我的错误;我必须尽快提交!
所以我删除打印元素? –
In: code = print(“<!Doctype html> \ n \ ... remove”code =“ – mchfrnc
Thanks!It works! –