Alfred urlencode/urldecode插件

自己做个工具

老去搜索在线的urldecode工具,直接搞一个吧,更加方便了
直接上关键Script代码:😉

urlencode

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# author: xu3352<xu3352@gmail.com>
# desc: urlencode

## python2
# import sys
# import urllib
# result = urllib.quote('{query}');
# sys.stdout.write(result);

## python3
import sys
import urllib.parse

result = urllib.parse.urlencode({'': '{query}'})
sys.stdout.write( result[1:] )

urldecode

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# author: xu3352<xu3352@gmail.com>
# desc: urldecode

## python2
# import urllib
# import sys

# result = urllib.unquote('{query}').decode('utf8');
# sys.stdout.write(result);

## python3
from urllib.parse import unquote
import sys

result = unquote(unquote('{query}'))
sys.stdout.write(result);

下载资源:

参考:



blog comments powered by Disqus

Published

22 January 2017

Tags