Javascript – JS-Code für Python
高洛峰
高洛峰 2017-06-22 11:51:54
0
1
824

Der js-Code lautet wie folgt

var e = a.charCodeAt(t).toString(16);这一行不明白
function encode_unicode_param(a) {
    for (var s = "", t = 0; t < a.length; t++) {
        var e = a.charCodeAt(t).toString(16);
        s += 2 == e.length ? "n" + e: e
    }
    return s
}
高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

Antworte allen(1)
滿天的星座

python3 下:

def encode_unicode_param(s):
    results = []
    for char in s:
        h = hex(ord(char))[2:]
        format_string = 'n{}' if len(h) == 2 else '{}'
        results.append(format_string.format(h))
    return ''.join(results)
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!