This article illustrates the method of using Python to implement the object-oriented ASP program. Share to everyone for your reference. The implementation methods are as follows:
Usually when we write ASP, we usually use VBScript or JavaScript.
JavaScript is the use of function to implement the class, very cumbersome, and the effect is unpleasant. VBScript can implement classes, but there are also significant functional limitations.
If you write an ASP script in Python, you can implement the real class and become a true object-oriented image. Consider the following example:
Copy Code code 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.jb51.net ')
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 ()
%>
I hope this article will help you with your Python programming.