【发布时间】:2022-01-09 16:47:15
【问题描述】:
我想尝试用base64 加密我的python 代码。
但是当我使用\n 时出现错误:
print("hello
IndentationError: unexpected indent
这是我使用的代码:
import base64
def encode(data):
try:
# Standard Base64 Encoding
encodedBytes = base64.b64encode(data.encode("utf-8"))
return str(encodedBytes, "utf-8")
except:
return ""
def decode(data):
try:
message_bytes = base64.b64decode(data)
return message_bytes.decode('utf-8')
except:
return ""
your_code = encode("""
print("hello \n world")
""")
exec(decode(your_code))
我可以使用两次print() 函数而不是\n,但是有没有办法使用\n?
希望你能帮帮我
【问题讨论】: