Working on html file in vs code

I know this might sound a very simple question but I’m using vs code to work on HTML file and not sure how to run some code in the terminal. I have installed the extensions for HTML, and python with no issue running python file. I download the library shown in the pic but does not seem to be working in HTML files. I am pretty new with HTML and vs code. Any help here.

Hello and welcome!

The terminal won’t offer an HTML live preview, but you can download a VS Code extension for that.

I installed live server but this display s the web page not a query. Any extension that allows query manipulation e.g., extracting text etc.

Well, you can use the live server extension with the developer console, but the manipulated queries on the developer console is not permanent. You can open the developer console by being on the webpage and pressing CTRL + SHIFT + I, and then there should be a tab called elements where it contains all your elements. It would look like this:

I have my console detached from the main browser. But by default, it should be docked to the right on Chrome and bottom on Firefox.

1 Like

I see! Thanks for the help, so does that mean you can find any text and run query on them? Let say I want to run this code on the text from my image in vs code and need to look some text

from bs4 import BeautifalSoup

soup = BeautifalSoup(html, "html.parser")

data = soup.body.contents[1]

I hope this make more sense.

Well, you can’t do that in HTML, because HTML is a markup. It only tells the browser where to put stuff and what is the content. It looks like the code you are showing is Python that can grab the HTML and XML element using a parser. You can try to look up how to set it up on Google.

You are right ! I appropriate the help, it’s just that my programming vocabulary isn’t that strong . Maybe I should change the file type to .py instead of .html. By the way, nice website . It is very motivational to read your blurb

1 Like