I have a loop putting URLs into my broswer and scraping its content, generating this output:

2PRACE,0.0014

Hispanic,0.1556

API,0.0688

Black,0.0510

AIAN,0.0031

White,0.7200

The code looks like this:

```
f1 = open('urlz.txt','r',encoding="utf8")
ethnicity_urls = f1.readlines()
f1.close()

from urllib import request
from bs4 import BeautifulSoup
import time
import openpyxl
import pprint

for each in ethnicity_urls:
    time.sleep(1)
    scraped = request.urlopen(each)
    soup = BeautifulSoup(scraped)
    soup1 = soup.select('p')
    print(soup1)
    resultFile = open('results.csv','a')
    resultFile.write(pprint.pformat(soup1))
    resultFile.close()

```

My problem is quite simple yet I do not find any tool that helps me achieve it. I would like to change the output from a list with "\n" in it to this:
2PRACE,0.0014 Hispanic,0.1556 API,0.0688 Black,0.0510 AIAN,0.0031 White,0.7200

I did not succeed by using replace as it told me I am treating a number of elements the same as a single element. 
My approach here was:

```
for each in ethnicity_urls:
    time.sleep(1)
    scraped = request.urlopen(each)
    soup = BeautifulSoup(scraped)
    soup1 = soup.select('p')
    soup2 = soup1.replace('\n',' ')
    print(soup2)
    resultFile = open('results.csv','a')
    resultFile.write(pprint.pformat(soup2))
    resultFile.close()

```

Can you help me find the correct approach to mutate the output before writing it to a csv?
The error message I get:
AttributeError: ResultSet object has no attribute 'replace'. You're probably treating a list of elements like a single element. Did you call find\_all() when you meant to call find()?

---

See the solution to the problem in my answer below. Thanks for all the responses!