mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 16:57:40 +00:00
[utils] Add encode_dict
This commit is contained in:
parent
be0e5dbd83
commit
1639282434
1 changed files with 4 additions and 0 deletions
|
@ -1638,6 +1638,10 @@ def urlencode_postdata(*args, **kargs):
|
|||
return compat_urllib_parse.urlencode(*args, **kargs).encode('ascii')
|
||||
|
||||
|
||||
def encode_dict(d, encoding='utf-8'):
|
||||
return dict((k.encode(encoding), v.encode(encoding)) for k, v in d.items())
|
||||
|
||||
|
||||
try:
|
||||
etree_iter = xml.etree.ElementTree.Element.iter
|
||||
except AttributeError: # Python <=2.6
|
||||
|
|
Loading…
Reference in a new issue