我很难用python编写一个非常简单的html文件。你知道吗
代码是:
filehtml = 'C:\pathhere\helloworld.html'
message = '''<html>
<head></head>
<body><p><Hello World!</p></body>
</html>'''
f = open(filehtml,'w')
f.write(message)
f.close()
这个文件看起来大约有65个字节,但是当我在chrome或firefox中打开它时,它是空白的。文件图标上有一个小锁,但当我右键单击选项时,权限包括我。所以…我不知道这是代码问题还是别的什么。另外,我桌面上的所有其他文件都有锁,我可以很好地打开它们。 我在这里寻求帮助(How to write and save html file in python?)
我用的是Windows7,Python2.7Anaconda 谢谢。你知道吗
你有一个额外的
<
,它把一切都搞砸了。你知道吗相关问题 更多 >
编程相关推荐