关于Ruby的HTTP访问,怎样只峄白刺

Python018

关于Ruby的HTTP访问,怎样只峄白刺,第1张

试试这个方法:include <iostream>

#include <stdio.h>

int jc(int m){

if(m!=1) return m*jc(m-1)

else return 1

}

int c(int m,int n){

if(m>=n) return jc(m)/(jc(n)*jc(m-n))

}

int main(void){

int m,n

scanf("%d%d",&m,&n)

printf("%d\n",c(m,n))

return 0

}

本文实例讲述了python通过get,post方式发送http请求和接收http响应的方法。分享给大家供大家参考。具体如下:

测试用CGI,名字为test.py,放在apache的cgi-bin目录下:

#!/usr/bin/python

import cgi

def main():

print "Content-type: text/html\n"

form = cgi.FieldStorage()

if form.has_key("ServiceCode") and form["ServiceCode"].value != "":

print "<h1>Hello",form["ServiceCode"].value,"</h1>"

else:

print "<h1>Error! Please enter first name.</h1>"

main()

python发送post和get请求

get请求:

使用get方式时,请求数据直接放在url中