用python实现面向对像的ASP程序实例
作者:shichen2014 时间:2023-05-19 04:20:55
本文实例讲述了用python实现面向对像的ASP程序的方法。分享给大家供大家参考。具体实现方法如下:
平时我们写ASP时,一般都用vbscript或javascript.
javascript是用function来实现类的,很麻烦,而且效果不爽. vbscript虽然可以实现类,但是功能上也有很大的局限性.
如果用python来写ASP脚本,就可以实现真的类,成为真正的面向对像.请看下面的例子:
<%@LANGUAGE="python" CODEPAGE="936"%>
<%
import sys
import urllib
class urtt:
def __init__(self):
self.text1='testpython'
def urt(self):
fr=urllib.urlopen('https://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()
%>
希望本文所述对大家的Python程序设计有所帮助。
标签:python,ASP
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python3 判断列表是一个空列表的方法
2022-02-03 09:40:07
安装PyInstaller失败问题解决
2022-03-18 04:21:41
![](https://img.aspxhome.com/file/2023/1/92431_0s.png)
python网络爬虫学习笔记(1)
2023-12-24 04:08:16
2020史上最全IDEA插件总结(推荐收藏)
2023-11-13 07:13:41
![](https://img.aspxhome.com/file/2023/4/85504_0s.jpg)
Python开发之快速搭建自动回复微信公众号功能
2022-06-27 03:08:04
![](https://img.aspxhome.com/file/2023/8/117288_0s.jpg)
对xml操作的主要方法例子
2008-06-29 14:21:00
Python下载商品数据并连接数据库且保存数据
2024-01-16 00:26:05
![](https://img.aspxhome.com/file/2023/1/103611_0s.png)
Python中pygal绘制雷达图代码分享
2023-09-27 10:03:59
![](https://img.aspxhome.com/file/2023/7/88857_0s.jpg)
MySQL 数据库 source 命令详解及实例
2024-01-15 10:50:58
![](https://img.aspxhome.com/file/2023/0/113570_0s.png)
Python读写ini文件的方法
2022-01-19 20:58:42
Django前端BootCSS实现分页的方法
2023-12-21 01:45:34
![](https://img.aspxhome.com/file/2023/8/103348_0s.gif)
python中urlparse模块介绍与使用示例
2021-08-08 10:13:18
Python比较配置文件的方法实例详解
2021-11-27 05:54:35
go语言编程学习实现图的广度与深度优先搜索
2024-05-22 10:16:34
![](https://img.aspxhome.com/file/2023/5/123905_0s.png)
Selenium python时间控件输入问题解决方案
2023-09-05 19:35:25
![](https://img.aspxhome.com/file/2023/8/79608_0s.png)
Python selenium爬取微信公众号文章代码详解
2023-12-10 19:43:18
![](https://img.aspxhome.com/file/2023/6/120586_0s.png)
Python中字符串切片详解
2022-04-27 01:58:11
![](https://img.aspxhome.com/file/2023/7/107607_0s.png)
python爬虫之自动登录与验证码识别
2022-05-18 07:22:53
基于Python实现文件的压缩与解压缩
2023-12-24 09:07:58
![](https://img.aspxhome.com/file/2023/9/63599_0s.jpg)
简单的Python2.7编程初学经验总结
2021-03-18 01:27:11
![](https://img.aspxhome.com/file/2023/1/124901_0s.jpg)