Python Forum
replace html string with python variable !
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
replace html string with python variable !
#1
hello all ...
im trying to run this command on the system ( whoami ) and i need to result for the command to be saved in html page ...

this is my code ...

import os
qassam = os.system("whoami")

html_str = """
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>test</h1> <============================================== i need to replace test with ( qassam = os.system("whoami") ) result !!
<p>My first paragraph.</p>

</body>
</html>
"""

Html_file= open(r"C:\Users\adam\AppData\q.html","w")
Html_file.write(html_str)
Html_file.close()
how i can do that ?
Reply


Messages In This Thread
replace html string with python variable ! - by evilcode1 - Aug-30-2018, 10:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Replace a text/word in docx file using Python Devan 4 3,675 Oct-17-2023, 06:03 PM
Last Post: Devan
  Need to replace a string with a file (HTML file) tester_V 1 799 Aug-30-2023, 03:42 AM
Last Post: Larz60+
  Replacing String Variable with a new String Name kevv11 2 819 Jul-29-2023, 12:03 PM
Last Post: snippsat
  why doesn't it replace all html tags? Melcu54 3 789 Jul-05-2023, 04:47 AM
Last Post: Melcu54
  Replace string in a nested Dictianory. SpongeB0B 2 1,250 Mar-24-2023, 05:09 PM
Last Post: SpongeB0B
  Replace with upper(string) WJSwan 7 1,633 Feb-10-2023, 10:28 AM
Last Post: WJSwan
  Need help on how to include single quotes on data of variable string hani_hms 5 2,136 Jan-10-2023, 11:26 AM
Last Post: codinglearner
  Tkinterweb (Browser Module) Appending/Adding Additional HTML to a HTML Table Row AaronCatolico1 0 964 Dec-25-2022, 06:28 PM
Last Post: AaronCatolico1
  python r string for variable mg24 3 2,912 Oct-28-2022, 04:19 AM
Last Post: deanhystad
  USE string data as a variable NAME rokorps 1 990 Sep-30-2022, 01:08 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020