สร้างไฟล์ python-html.py | |
#!/usr/bin/ python
import os ,webbrowser
name = "Nawamin"
last ="Norueng"
nick="Top"
birth="09/12/1993"
ID ="550012620146"
number="083908613"
mail="nawamin_top@hotmail.co.th"
print "Name : "+ name
print "Last_Name : "+ last
print "Nick_Name : "+ nick
print "Brith_Day : "+ birth
print "Student_ID : "+ ID
print "TerephonNumber : "+ number
print "E-Mail: "+ mail
html="""
<html> <body bgcolor='gray'> <center> <table border="1">
<head>
<title>MyProfile</title>
</head>
<body>
<font size =5>
<marquee> Welcome To Myprofile </marquee>
<br><br>
<a href=https://www.facebook.com/photo.php?fbid=787570894633872&set=a.265401720184128.63023.100001429062065&type=3&src=https%3A%2F%2Ffbcdn-sphotos-e-a.akamaihd.net%2Fhphotos-ak-xpa1%2Fv%2Ft1.0-9%2F10704057_787570894633872_8027622696079978686_n.jpg%3Foh%3D2c89f8779aa86e2589db54c60017b0eb%26oe%3D552A8221%26__gda__%3D1432736665_a337304919e02f103a0be952f7ff9171&size=960%2C720
h><img src=https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-xpa1/v/t1.0-9/p180x540/10704057_787570894633872_8027622696079978686_n.jpg?oh=05b3b4b0d84b38de3c12f061fe02adc9&oe=5529D238&__gda__=1428985310_8b9cdcc63aeb0557d32d4ae1657e9cfa
eight=300 width=200></a>
<br>
Name : """+name+"""<br>
Last_Name : """+last+"""<br>
Nick_Name : """+nick+"""<br>
Brith_Day :"""+birth+"""<br>
Student_ID : """+ID+"""<br>
TerephonNumber : """+number+"""<br>
E-Mail: """+mail+"""<br>
<a href=http://facebook.com/topcappom>......Facebook......</a>
</font>
</body>
</html>"""
print html
python_html = open("myprofile.html", "w+")
python_html.write(html)
python_html.close()
webbrowser.open("./myprofile.html")
Run ไฟล์ python-html.py | |
Run ไฟล์ python-html.py โดยใช้คำสั่ง python python-html.py
output:
Name : Nawamin
Last_Name : Norueng
Nick_Name : Top
Brith_Day : 09/12/1993
Student_ID : 550012620146
TerephonNumber : 083908613
E-Mail: nawamin_top@hotmail.co.th
<html> <body bgcolor='gray'> <center> <table border="1">
<head>
<title>MyProfile</title>
</head>
<body>
<font size =5>
<marquee> Welcome To Myprofile </marquee>
<br><br>
<a href=https://www.facebook.com/photo.php?fbid=787570894633872&set=a.265401720184128.63023.100001429062065&type=3&src=https%3A%2F%2Ffbcdn-sphotos-e-a.akamaihd.net%2Fhphotos-ak-xpa1%2Fv%2Ft1.0-9%2F10704057_787570894633872_8027622696079978686_n.jpg%3Foh%3D2c89f8779aa86e2589db54c60017b0eb%26oe%3D552A8221%26__gda__%3D1432736665_a337304919e02f103a0be952f7ff9171&size=960%2C720
h><img src=https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-xpa1/v/t1.0-9/p180x540/10704057_787570894633872_8027622696079978686_n.jpg?oh=05b3b4b0d84b38de3c12f061fe02adc9&oe=5529D238&__gda__=1428985310_8b9cdcc63aeb0557d32d4ae1657e9cfa
eight=300 width=200></a>
<br>
Name : Nawamin<br>
Last_Name : Norueng<br>
Nick_Name : Top<br>
Brith_Day :09/12/1993<br>
Student_ID : 550012620146<br>
TerephonNumber : 083908613<br>
E-Mail: nawamin_top@hotmail.co.th<br>
<a href=http://facebook.com/topcappom>......Facebook......</a>
</font>
</body>
</html>
ubuntu@ubuntu:~/Desktop/building$
(process:6756): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
แสดงผลบน Browser | |
output ไฟล์ myprofile.html | |
<html> <body bgcolor='gray'> <center> <table border="1">
<head>
<title>MyProfile</title>
</head>
<body>
<font size =5>
<marquee> Welcome To Myprofile </marquee>
<br><br>
<a href=https://www.facebook.com/photo.php?fbid=787570894633872&set=a.265401720184128.63023.100001429062065&type=3&src=https%3A%2F%2Ffbcdn-sphotos-e-a.akamaihd.net%2Fhphotos-ak-xpa1%2Fv%2Ft1.0-9%2F10704057_787570894633872_8027622696079978686_n.jpg%3Foh%3D2c89f8779aa86e2589db54c60017b0eb%26oe%3D552A8221%26__gda__%3D1432736665_a337304919e02f103a0be952f7ff9171&size=960%2C720
h><img src=https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-xpa1/v/t1.0-9/p180x540/10704057_787570894633872_8027622696079978686_n.jpg?oh=05b3b4b0d84b38de3c12f061fe02adc9&oe=5529D238&__gda__=1428985310_8b9cdcc63aeb0557d32d4ae1657e9cfa
eight=300 width=200></a>
<br>
Name : Nawamin<br>
Last_Name : Norueng<br>
Nick_Name : Top<br>
Brith_Day :09/12/1993<br>
Student_ID : 550012620146<br>
TerephonNumber : 083908613<br>
E-Mail: nawamin_top@hotmail.co.th<br>
<a href=http://facebook.com/topcappom>......Facebook......</a>
</font>
</body>
</html>
<head>
<title>MyProfile</title>
</head>
<body>
<font size =5>
<marquee> Welcome To Myprofile </marquee>
<br><br>
<a href=https://www.facebook.com/photo.php?fbid=787570894633872&set=a.265401720184128.63023.100001429062065&type=3&src=https%3A%2F%2Ffbcdn-sphotos-e-a.akamaihd.net%2Fhphotos-ak-xpa1%2Fv%2Ft1.0-9%2F10704057_787570894633872_8027622696079978686_n.jpg%3Foh%3D2c89f8779aa86e2589db54c60017b0eb%26oe%3D552A8221%26__gda__%3D1432736665_a337304919e02f103a0be952f7ff9171&size=960%2C720
h><img src=https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-xpa1/v/t1.0-9/p180x540/10704057_787570894633872_8027622696079978686_n.jpg?oh=05b3b4b0d84b38de3c12f061fe02adc9&oe=5529D238&__gda__=1428985310_8b9cdcc63aeb0557d32d4ae1657e9cfa
eight=300 width=200></a>
<br>
Name : Nawamin<br>
Last_Name : Norueng<br>
Nick_Name : Top<br>
Brith_Day :09/12/1993<br>
Student_ID : 550012620146<br>
TerephonNumber : 083908613<br>
E-Mail: nawamin_top@hotmail.co.th<br>
<a href=http://facebook.com/topcappom>......Facebook......</a>
</font>
</body>
</html>
No comments:
Post a Comment