【发布时间】:2018-11-01 21:16:15
【问题描述】:
想象一下,我有index = 0、hash = '06123gfhtg75677687fgfg4',我想处理像hash[i++] 这样的表达式。如何在 Python3 中做到这一点?
注意,这个表达式后面需要index = 1。如果可能的话,我需要一行表达式。
预期用途如下:
enc = bytes(enc % len(session_key))
x = bytes(data[i] ^ session_key[enc++]) + ej)
data[i] = ej = x
【问题讨论】:
-
hash[i]然后在下一行i += 1。 -
@Aran-Fey 我需要单行表达,如果可能的话
-
“如果可能的话,我需要单行表达式”——你认为你为什么需要这个?
-
enc++ 应该做什么?
-
您的示例不需要在
x =行内隐藏更新。您可以在下一行执行enc += 1,您将获得更清晰、更易于理解的代码。
标签: python python-3.5 increment