#!/usr/bin/env python
# encoding: utf-8
"""
@author: wanwei
@license: (C) Copyright 2013-2017, Node Supply Chain Manager Corporation Limited.
@contact:
@software: pycharm
@file: parse_url.py
@time: 2019/9/2 14:18
@desc:
"""
from urllib import parse
url = "https://confluence.ss.work/pages/viewpage.action?pageId=3965148"
url_parsed = parse.urlparse(url)
bits = list(url_parsed)
qs = parse.parse_qs(bits[4])
qs['pageId'] = '3965150'
bits[4] = parse.urlencode(qs)
url_new = parse.urlunparse(bits)
print(url)
print(url_new)
python修改url参数
最新推荐文章于 2023-04-13 16:59:55 发布