IHYPRESS PROGRAMMING
CGI/Python programs with code and output for beginners
classic asp
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Python (CGI Programming) ❯ Formatted Print
<05>
#!/usr/bin/python import sys print "Content-type: text/html\n\n" print "<div style='font-size:1.3em;color:Brown;'>" #printing a string containing html iframe = '<iframe src="https://yimago.net/embed/classiccomposers.php?play=0" style="width:240px;height:120px;border:1px solid Black;border-radius:10px;"></iframe>' print('%s<br>' % iframe) #placeholders string1 = "{city} is on the island of {island}".format(city="Hilo", island="Hawai'i") string2 = "{0} is on the island of {1}".format("Nassau","New Providence") string3 = "{0} is the capital of {1}".format("Paris","France") print string1; print '<br>' print string2; print '<br>' print string3; print '<br>' #numerical formatted prints print('%d<br>' % 77) print('%.3f<br>' % 2.5) print('%.4f<br>' % 2.5) print('%.1f<br>' % 2.56) print('%.1f %.2f<br>' % (43.678, 78.8964)) #concatenation s2 = 'The ' + 'quick ' + 'brown ' + 'fox.' print(s2); print '<br>' #html with heredoc html = ''' <p style="color:Blue;font-size:24px;width:450px;border:1px solid red;"> Abracadabra </p> ''' print html print ("</div>")
Hergestellt in Deutschland / Made in Germany

Hilo is on the island of Hawai'i
Nassau is on the island of New Providence
Paris is the capital of France
77
2.500
2.5000
2.6
43.7 78.90
The quick brown fox.

Abracadabra

COPYRIGHT © 2015-2025 IHY PRESS Frankfurt am Main 60329 Deutschland