python和dotnet的webservice互访
2007-08-22 22:46
一、用SOAPpy访问dotnet webservice
dotnet的webservice
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
<WebMethod()> _
Public Function HelloWorld2(ByVal s As String) As String
Return "Hello World2" + s
End Function
<WebMethod()> _
Public Function HelloWorld3(ByVal i As Int16, ByVal j As Int16) As String
Return "Hello World3" + (i + j).ToString()
End Function
命名空音后加一句 SoapDocumentService(Use:=SoapBindingUse.Encoded)
访问
>>>from SOAPpy import WSDL
>>> server= WSDL.Proxy("http://192.168.1.3/mywebservice/Service1.asmx?WSDL
")
>>> server.HelloWorld()
'Hello World'
>>> server.HelloWorld('abcdefg')
'Hello World'
>>> server.HelloWorld2('abcdefg')
'Hello World2'
>>> server.HelloWorld2(s = 'abcdefg') #有参数时,需带上参数名
'Hello World2abcdefg'
>>> server.HelloWorld3(i=1,j=2) #暂未解决
Traceback (most recent call last):
File "<pyshell#43>", line 1, in -toplevel-
server.HelloWorld3(i=1,j=2)
File "c:\python24\Lib\site-packages\SOAPpy\Client.py", line 453, in __call__
相关文档:
谢了一个自动下载指定人的博客的脚本
这个脚本是用来下载csdn博客的
同样的方法可以下载一般其他网站的博客,如sina
有时页面访问会被拒绝,重新运行即可
这种程序是在分析了指定网站,我在这儿是csdn,之后编写出的
会牵涉到网页的编码问题,有时程序运行会因此终止
我自己的博客已经下载忘了
只是下载网页
使用网 ......
Python中字符串被定义为引号之间的字符集合。Python支持使用成对的单引号或双引号,三引号包含的字符串。
使用索引操作符([])和切片操作符([:])可以得到子字符串。字符串有其特有的索引规则:第一个字符的索引是0
,最后一个字符的索引是-1。
加号(+)用于字符串连接运算,星号(*)则用于字符串重复。如下例:
pystr = " ......
能整理大部分无用文件
#!/usr/bin/python
#syscleaner.py
import os
import os.path
#delete files and directory recursively
def itedel(dir):
print('in dir :'+dir)
for doc in os.listdir(dir):
try:
if(os.path.isdir(doc)):
itedel(dir+'\\'+doc)
......
[root@pku-fan MySQL]# cat limbs.sql
CREATE DATABASE cookbook;
USE cookbook;
DROP TABLE IF EXISTS limbs;
CREATE TABLE limbs
(
thing VARCHAR(20), # what the thing is
legs INT, ......