For loop outputting one character per line
<p>I'm writing a quick python script wrapper to query our crashplan server so I can gather data from multiple sites then convert that to json for a migration and I've got most of it done. It's probably a bit ugly, but I'm one step away from getting the data I need to pass on to the json module so I can format the data I need for reports.</p>

<p>The script should query ldap, get a list of names from a list of sites, then create a command (which works).</p>

<p>But when printing the list in a for loop it prints out each character, instead of each name. If I just print the list it prints out each name on a single line. This obviously munges up the REST call as the username isn't right.</p>

<pre><code>'''
Crashplan query script

Queries the crashplan server using subprocess calls and formats the output

'''

import subprocess
import json

password = raw_input("What password do you want to use: ")

sitelist = ['US - DC - Washington', 'US - FL - Miami', 'US - GA - Atlanta', 'CA - Toronto']
cmdsites = ""


for each in sitelist:
    cmdsites = cmdsites + '(OfficeLocation={})'.format(each)

ldap_cmd = "ldapsearch -xLLL -S OfficeLocation -h ldap.local.x.com -b cn=users,dc=x,dc=com '(&amp;(!(gidNumber=1088))(|%s))' | grep -w 'uid:' | awk {'print $2'}" % cmdsites

users = subprocess.check_output([ldap_cmd], shell=True)

##### EVERYTHING WORKS UP TO THIS POINT #####

for each in users:
    #    subprocess.call(['curl -X GET -k -u "admin:'+password+'" "https://crashplan.x.com:4285/api/User?username='+each+'@x.com&amp;incBackupUsage=true&amp;strKey=lastBackup"'], shell=True)   ### THIS COMMAND WORKS IT JUST GETS PASSED THE WRONG USERNAME
    print each           #### THIS PRINTS OUT ONE LETTER PER LINE ####

print type(users)   #### THIS PRINTS OUT ONE NAME PER LINE ####
</code></pre>