Solution:
from urllib.parse import quote
# 原始字符串
raw_string = "Hello, World! How are you?"
# 对字符串进行 URL 编码
encoded_string = quote(raw_string)
print("原始字符串:", raw_string)
print("URL 编码后:", encoded_string)
No comments:
Post a Comment