Q:

Python spacing in file handling and Os library

When I import a string inside a readfile that has contents like :
user1
aword
anotherword..
etc

I am usually storing them inside a word like as user and password  (here):
for user in userfile:
    for password in passwordfile:

        c0 = 'curl -s --connect-timeout 2 https://somewebaddress -k --data username='+'"'+username+'"'+' --data password='+'"'+password+'"'+' --data mode=191 2>&1'
        print (c0)

        str0=str(os.popen(c0).readlines())  
        print ( str0) 

I get a serious issue and the print(c0) actually takes in the entire line.
I tried editing the user and password strings with the split function and using string.split[0] but, That doesnt solve the problem yet. Any ideas on how to get string c0 printed exactly like this
curl -s --connect-timeout 2 https:somewebaddress -k --data username="username_from_file" --data password="password_from_file" --data mode=191 2>&1

without any "\n" .
This is because os.popen and is very strict and doesnot give me desired results so far.

A:

The function strip() in class str removes leading and trailing whitespace from a string.  An unwanted \n at the end of the string would be removed.

