-3

I need help trying to convert an ASCII list to a string list, I have already tried this: ciphertext = str[Nintendo65] However it keeps outputting this: TypeError: 'type' object is not subscriptable

Zac Cotterell
  • 105
  • 1
  • 1
  • 8
  • So clearly `Nintendo65` isn't what you think it is, have you looked into that at all? – jonrsharpe Feb 22 '16 at 17:48
  • What do you think a "String array" is? What's `Nintendo65` before? – Adam Smith Feb 22 '16 at 17:48
  • And what does that have to do with writing something to a file? – Tim Pietzcker Feb 22 '16 at 17:56
  • The first version of this question did `str(Nintendo65)` and wrote out a repr string for an `_io.TextWrapper`. Then he edited it to doing `str[Nintendo65]` and of course got the "not subscriptable" TypeError. Voting to close until OP figures out what his question is. – Adam Smith Feb 22 '16 at 18:02

1 Answers1

0
str[x]

tries to access the xth element of str (which fails with the error you saw).

If you want to convert some object to a string, the correct syntax is

my_string = str(my_obj)

That gives you a string. If you want to convert that to a list containing each character of your string as one element, use

char_list = list(my_string)
Tim Pietzcker
  • 328,213
  • 58
  • 503
  • 561