Python 如何在没有.append()的情况下继续添加到数组?

Python 如何在没有.append()的情况下继续添加到数组?,python,Python,长话短说,我正在编写一个程序来解码隐藏在音频文件中的消息,我遇到了一个问题,我需要在数组或字符串中存储一个“提取”的ASCII字母,以便打印完整的消息。我当前的代码只给出了“消息”中的最后一个字母 如何让我的代码显示隐藏在屏蔽音频中的所有字母?此外,我必须在不导入任何模块的情况下执行此操作。您得到的是最后一个字母,因为它总是在每个循环中替换变量“ascilet”。尝试创建初始值,然后添加它。 youre getting the last letter because it always repl

长话短说,我正在编写一个程序来解码隐藏在音频文件中的消息,我遇到了一个问题,我需要在数组或字符串中存储一个“提取”的ASCII字母,以便打印完整的消息。我当前的代码只给出了“消息”中的最后一个字母

如何让我的代码显示隐藏在屏蔽音频中的所有字母?此外,我必须在不导入任何模块的情况下执行此操作。

您得到的是最后一个字母,因为它总是在每个循环中替换变量“ascilet”。尝试创建初始值,然后添加它。
youre getting the last letter because it always replaced the  variable 'asciiLet' every loop. try to create an inital value then add it. 

def decode(sound):
  asciiLet = '' #<--- inital
  for sample in getSamples (sound):
      ampValue = getSampleValue (sample)
      asciiNum = ampValue % 128


      if asciiNum == 0:
        break

      asciiLet += chr (asciiNum)  #<--- add it 


  showInformation (asciiLet)
def解码(声音):
asciiLet=''我没有看到任何数组在这里被修改。为什么没有
append()
?另一种选择是将
showInformation(asciiLet)
移动到循环中。@TigerhawkT3,因为我正在使用的Python的“版本”(对于此赋值是必需的)没有.append()命令。不幸的是,使用不同的
list
类构建Python的实现需要付出很大的努力。你确定它不可用,或者你只是没有正确使用它吗?是的,我想这就是问题所在,但这个解决方案似乎没有帮助。相反,它无限循环并显示最后一个解码的字母。
youre getting the last letter because it always replaced the  variable 'asciiLet' every loop. try to create an inital value then add it. 

def decode(sound):
  asciiLet = '' #<--- inital
  for sample in getSamples (sound):
      ampValue = getSampleValue (sample)
      asciiNum = ampValue % 128


      if asciiNum == 0:
        break

      asciiLet += chr (asciiNum)  #<--- add it 


  showInformation (asciiLet)