title: Python3: TypeError: sequence item 0: expected str instance, list found
body: <p>I'm trying to print all of the possible character substitutions for the word &quot;otaku&quot;.</p>
  <pre class="lang-py prettyprint-override"><code>#!/usr/bin/python3
  
  import itertools
  
  user_input = &quot;otaku&quot;
  
  dict = {
  'c': ['c', 'C'],
  'a': ['a', 'A', '@'],
  't': ['t', 'T'],
  'k': ['k', 'K'],
  'u': ['u', 'U'],
  'e': ['e', 'E', '3'],
  'o': ['o', 'O', '0']
  }
  
  output = &quot;&quot;
  
  for i in itertools.product(dict['o'],dict['t'],dict['a'],dict['k'],dict['u']):
      output += ''.join(i) + &quot;\n&quot;
  
  print(output)
  </code></pre>
  <p>The above script works but I need the <code>itertools.product()</code> input (<code>dict['o'],dict['t'],dict['a'],dict['k'],dict['u']</code>) to be dynamic (e.g., <code>new_list</code>):</p>
  <pre class="lang-py prettyprint-override"><code>#!/usr/bin/python3
  
  import itertools
  
  user_input = &quot;otaku&quot;
  
  dict = {
  'c': ['c', 'C'],
  'a': ['a', 'A', '@'],
  't': ['t', 'T'],
  'k': ['k', 'K'],
  'u': ['u', 'U'],
  'e': ['e', 'E', '3'],
  'o': ['o', 'O', '0']
  }
  
  new_list = []
  
  for i in user_input:
      new_list.append(dict[i])
  
  output = &quot;&quot;
  
  for i in itertools.product(new_list):
      output += ''.join(i) + &quot;\n&quot;
  
  print(output)
  </code></pre>
  <p>This errors with:</p>
  <pre><code>TypeError: sequence item 0: expected str instance, list found
  </code></pre>
  <p>I tried the solutions found <a href="https://stackoverflow.com/questions/10880813/typeerror-sequence-item-0-expected-string-int-found">here</a>, but converting the list to a str breaks the itertools.product line.</p>
  <p>How can I pass dynamic input into <code>itertools.product()</code>?</p>
  <p>Desired output:</p>
  <pre><code>otaku
  otakU
  otaKu
  otaKU
  otAku
  otAkU
  otAKu
  otAKU
  ot@ku
  ot@kU
  ot@Ku
  ot@KU
  oTaku
  oTakU
  oTaKu
  oTaKU
  oTAku
  oTAkU
  oTAKu
  oTAKU
  oT@ku
  oT@kU
  oT@Ku
  oT@KU
  Otaku
  OtakU
  OtaKu
  OtaKU
  Ot@KU
  </code></pre>