Html vs Python

So in HTML you have the < !---- > comment and the id that identify an element. Are these both similar in function to the “#” in Python? Or are they completely different from each other?

1 Like

The <!-- comment --> is very similar to # in python. The key difference is that you can have a multi-line comment by default in html whereas in python you need to either re-write # or use the the tick mark notation.

The id however is not quite the same as what you may experience in python. It is a unique identifier to everything you have under that id tag.


Piggyback off of what @toastedpitabread said.

In HTML, if you want to create a multiline comment, you can just use one <!-- -->:

<!-- Blah blah blah.
This is also commented out
This, too. -->

<p>Hello world!</p>

Whereas in Python, you have to use multiple # hashtags to create multiple comments:

# This is commented out.
# So is this.
# And also this.

print('Hello world!')

HTML and Python is the very different coding language.

HTML is a completely different language than even JavaScript, let alone Python. What makes it beautiful is the DOM. What HTML is not, is dynamic. We have static, raw text that needs a parsing engine to discern between tags and content. When the HTML is loaded that engine builds the DOM. JavaScript makes it possible for us to manipulate it.

Python, Ruby, PHP cannot do what JS can. They have no interface with the document, proper. All they can do is generate server responses.

The client side has only the browser to rely upon. There is no built in Python interpreter, only HTML, CSS, and JavaScript.

1 Like