Join strings for series of nested lists in Python 2.7.2
<p>I have a series of lists that contain an integer and a nested list with multiple strings.  The goal is to join the strings into one string.  I have accomplished this with code that works on one list.  The problem is when I try to iterate over the series of lists there is an error: "TypeError: sequence item 0: expected string, int found."  I have tried to change the integer to a string, ignore items that are integers and direct the code to the nested list without success. </p>

<p>Example of series:</p>

<pre><code>    [19497, ['83', 'CLM']]
    [19498, ['80', 'COS', 'PAN', '83', 'CLM']]
    [19505, ['79', 'MXE', 'MXN', 'MXS']]
    [19507, ['83', 'CLM', 'ECU']]
    [19509, ['79', 'MXG', 'MXS', 'MXT', '80', 'BLZ', 'GUA', 'HON', 'NIC']]
</code></pre>

<p>This works for one list:</p>

<pre><code>    &gt;&gt;&gt; q = [48, ['40', 'ASS', 'EHM', 'IND', 'NEP', 'WHM', '41', 'MYA']]
    &gt;&gt;&gt; q[1] = " ".join(q[1])
    &gt;&gt;&gt; q
    [48, '40 ASS EHM IND NEP WHM 41 MYA']
</code></pre>

<p>This is what I tried for the iteration and get the type error.</p>

<pre><code>    def smush(q):
        '''STILL IN PROGRESS: Trying to create single string in nested list.'''
        for line in q:
            q[1] = ' '.join(q[1])
        return q
</code></pre>

<p>I have a feeling there is a simple solution to this I have overlooked.  Suggestions? </p>

<p>Thanks for any help you can provide.</p>
