不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
使用Python脚本编写ASP
编辑:dnawo 日期:2009-07-27
要让IIS支持Python编写的脚本,前提是得在IIS上安装Python脚本引擎,这边建议安装ActivePython 2.6.2,它是一个不错的Python开发IDE,安装ActivePython时会自动在IIS安装Python脚本引擎。
下边是用Python编写的一个ASP页面:
Rectangle.py:
说明:Rectangle.py必须放在sys.path其中一个路径中,否则程序运行会出错,提示:ImportError: No module named Rectangle!
下边是用Python编写的一个ASP页面:
复制内容到剪贴板 程序代码
<%@LANGUAGE="python" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Python测试-Mzwu.Com</title>
</head>
<body>
<%
from Rectangle import *
rectangle = Rectangle(50,100)
area = rectangle.Area()
Response.Write(area)
Response.Write("<br/>")
Response.Write(rectangle.ToString())
Response.Write("<br/>")
Response.Write(str(rectangle.__dict__))
%>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Python测试-Mzwu.Com</title>
</head>
<body>
<%
from Rectangle import *
rectangle = Rectangle(50,100)
area = rectangle.Area()
Response.Write(area)
Response.Write("<br/>")
Response.Write(rectangle.ToString())
Response.Write("<br/>")
Response.Write(str(rectangle.__dict__))
%>
</body>
</html>
Rectangle.py:
复制内容到剪贴板 程序代码
#Python 2.6.2
class Rectangle:
'''Class Rectangle.
description.'''
#constructor
def __init__(self,width,height):
self.Width = width
self.Height = height
#public methods
def Area(self):
return self.Width * self.Height
def ToString(self):
return 'Width:%s,Height:%s' % (self.Width,self.Height)
class Rectangle:
'''Class Rectangle.
description.'''
#constructor
def __init__(self,width,height):
self.Width = width
self.Height = height
#public methods
def Area(self):
return self.Width * self.Height
def ToString(self):
return 'Width:%s,Height:%s' % (self.Width,self.Height)
说明:Rectangle.py必须放在sys.path其中一个路径中,否则程序运行会出错,提示:ImportError: No module named Rectangle!
上一篇: PythonWin 2.6.2编写Python脚本无法保存解决方法
下一篇: Effective C# 原则12:选择变量初始化而不是赋值语句
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
最新日志:
下一篇: Effective C# 原则12:选择变量初始化而不是赋值语句
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
最新日志:
评论: 0 | 引用: 0 | 查看次数: 4010
发表评论
请登录后再发表评论!