Javascript建構網頁文件vs.Python建構word文件
現在 瀏覽器 建構網頁,然後在Spyder輸入docx函式庫,建構WORD文件。拷貝以下紅色框內的程式碼到記事本,另存檔名「自己名字.HTML」,存檔類型必須「*.*」。 <P id='shit'> 網頁和微軟WORD相同的命令document.paragraph</P> </body> <script> let t = document.createElement("H1"); t.innerText = "標題一"; t.style.background ='yellow'; document.body.appendChild(t); let u = document.createElement("P"); u.innerText = "創立create元素Element。"; u.style.background ='green'; document.body.appendChild(u); let v = document.createElement("SPAN"); v.innerText = "小段SPAN相當於WORD的run。"; v.style.background ='blue'; document.getElementById('shit').appendChild(v); </script>