Code: Alles auswählen
def p(data):
return ('<p>'+data+'<\p>')
print(p('hallo'))
Code: Alles auswählen
def p(data):
print ('<p>'+data+'<\p>')
p('hallo')
Wo sind die vor und Nachteile
Code: Alles auswählen
def p(data):
return ('<p>'+data+'<\p>')
print(p('hallo'))
Code: Alles auswählen
def p(data):
print ('<p>'+data+'<\p>')
p('hallo')
Code: Alles auswählen
#!/usr/bin/env python3
from markupsafe import Markup
def wrap_in_paragraph(content):
return Markup("<p>{}</p>").format(content)
def main():
print(wrap_in_paragraph("I <3 Python & HTML"))
if __name__ == "__main__":
main()
Code: Alles auswählen
<p>I <3 Python & HTML</p>
Code: Alles auswählen
import html
def get_paragraph(text):
escaped = html.escape(text)
return f"<p>{escaped}</p>"
print(get_paragraph("I <3 Python & HTML"))