Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/436.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在python中组合两个HTML代码_Javascript_Python_Html_Ipython Notebook - Fatal编程技术网

Javascript 在python中组合两个HTML代码

Javascript 在python中组合两个HTML代码,javascript,python,html,ipython-notebook,Javascript,Python,Html,Ipython Notebook,我用python编写了以下两个脚本。我在IPython笔记本中运行它们。当我在不同的单元格中调用Textbox1和Texbox2时,我看到两个框。但是,我希望这些文本框可以在外部HTML文件中看到。如何通过python组合并将其发送到HTML Textbox1=""" <!DOCTYPE html> <html> <head> <script> function retrieve(id) { var

我用python编写了以下两个脚本。我在IPython笔记本中运行它们。当我在不同的单元格中调用Textbox1和Texbox2时,我看到两个框。但是,我希望这些文本框可以在外部HTML文件中看到。如何通过python组合并将其发送到HTML

 Textbox1="""
    <!DOCTYPE html>
    <html>
    <head>
    <script>
    function retrieve(id) {
    var txtbox = document.getElementById(id);
    value = txtbox.value;
    }
    </script>
    </head>
    <body>
    <input type="text" size="4" style="width: 100px;" value="Enter Email"        name="txt" id="txt"></input>
    <input type="button" value="Submit" onclick="retrieve('txt');"/

    </body>
    </html>
    """`


 Textbox2="""
    <!DOCTYPE html>
    <html>
    <head>
    <script>
    function retrieve(id) {
    var txtbox = document.getElementById(id);
    value = txtbox.value;
    }
    </script>
    </head>
    <body>
    <input type="text" size="4" style="width: 100px;" value="Enter Password"        name="txt" id="txt"></input>
    <input type="button" value="Submit" onclick="retrieve('txt');"/

    </body>
    </html>
    """`
Textbox1=”“”
函数检索(id){
var txtbox=document.getElementById(id);
value=txtbox.value;
}

首先将两个框组合成一个HTML字符串,类似(我想需要格式化):

textbox1和textbox2=“”
函数检索(id){
var txtbox=document.getElementById(id);
value=txtbox.value;
}

是否只想将此html保存到externel文件?尝试使用open(mypath,'a)作为f:print(Textbox1,file=f)
。或者你的问题还有更多,而不是简单地写一个文件?
Textbox1and2="""
<!DOCTYPE html>
<html>
<head>
<script>
function retrieve(id) {
var txtbox = document.getElementById(id);
value = txtbox.value;
}
</script>
</head>
<body>
<input type="text" size="4" style="width: 100px;" value="Enter Email" name="txt" id="txt"></input>
<input type="button" value="Submit" onclick="retrieve('txt');"/
<input type="text" size="4" style="width: 100px;" value="Enter Password" name="txt" id="txt"></input>
<input type="button" value="Submit" onclick="retrieve('txt');"/

</body>
</html>
"""