Implementation of object-oriented ASP program instance _python with Python

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.