python填表_怎么用python填表-问答-阿里云开发者社区-阿里云

!user/bin/env python3

-- coding: utf-8 --

import sys

import mechanize

import cookielib

br = mechanize.Browser()

cj = cookielib.LWPCookieJar()

br.set_cookiejar(cj)

br.open('http://stu.szu.edu.cn:8080/account/signin/')

br.select_form(nr=0)

br.form['username'] = ['92']

br.form['password'] = 'office789'

response = br.submit() #上面几步是模拟登陆以获得cookies

print response.read()

reload(sys)

sys.setdefaultencoding('utf-8')

br.open('http://stu.szu.edu.cn:8080/meeting_room/apply/')

br.select_form(nr=0)

以下开始都是申请表的内容

br.form['meeting_topic'] = 'HYZT'

br.form['applicant_name'] = 'SQRXM'

br.form['applicant_phone_number'] = '00123456'

br.form['applicant_stu_id'] = '2015300025'

br.form['applicant_college'] = 'SQRXY'

br.form["place"] = ["石头坞一楼会议室"]

br.form["date_month"] = ["8"]

br.form["date_day"] = ["24"]

br.form["date_year"] = ["2018"]

br.form["time"] = ["8点-8点30分","8点30分-9点"]

form.set_value(["8点-8点30分","8点30分-9点"], name="time")

br.form['meeting_summary'] = 'meeting_summary'

br.form['remarks'] = 'remarks'

以上都是申请表的内容

response = br.submit()

print response.read()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值