如何写入 .txt 文件
How to write to a .txt file
我需要帮助尝试将 ASCII 列表转换为字符串列表,我已经尝试过这个:
ciphertext = str[Nintendo65]
但是它一直输出:TypeError: 'type' object is not subscriptable
str[x]
尝试访问 str
的第 x
个元素(失败并出现您看到的错误)。
如果你想将一些对象转换成字符串,正确的语法是
my_string = str(my_obj)
这给了你一个字符串。如果要将其转换为包含字符串的每个字符作为一个元素的列表,请使用
char_list = list(my_string)
我需要帮助尝试将 ASCII 列表转换为字符串列表,我已经尝试过这个:
ciphertext = str[Nintendo65]
但是它一直输出:TypeError: 'type' object is not subscriptable
str[x]
尝试访问 str
的第 x
个元素(失败并出现您看到的错误)。
如果你想将一些对象转换成字符串,正确的语法是
my_string = str(my_obj)
这给了你一个字符串。如果要将其转换为包含字符串的每个字符作为一个元素的列表,请使用
char_list = list(my_string)