In this paper, we describe the method of using Python to implement the ASP program oriented to the image. Share to everyone for your reference. The implementation method is as follows:
Usually when we write ASP, we usually use VBScript or JavaScript.
JavaScript is the use of function to implement class, very cumbersome, and the effect is uncomfortable. Although VBScript can implement classes, there are also significant limitations in functionality.
If you use Python to write ASP scripts, you can implement real classes and become true orientation. See the following example:
The code is as follows:
<% @LANGUAGE = "python" codepage= "936"%>
<%
Import Sys
Import Urllib
Class Urtt:
def __init__ (self):
self.text1= ' Testpython '
def urt (self):
Fr=urllib.urlopen (' http://www.bitsCN.com ')
for FL in Fr.readlines ():
Response.Write (Server.HTMLEncode (FL))
Fr.close ()
Response.Write (SELF.TEXT1)
Class Urtta (Urtt):
def __init__ (Self,url):
Self.strurl=url
self.text1= ' Textpython '
def urts (self):
Fr=urllib.urlopen (Self.strurl)
for FL in Fr.readlines ():
Response.Write (Server.HTMLEncode (FL))
Fr.close ()
Response.Write (SELF.TEXT1)
Utta=urtt ()
Utta.urt ()
Utt=urtta ("http://sohu.com")
Utt.urts ()
%>
Hopefully this article will help you with Python programming.