TypeError: cannot concatenate 'str' and 'instance' objects (python urllib)
python, urllib
Solution
urlopen(url) returns a file-like object. To obtain the string contents, try
CPs = CPs + urllib.urlopen(url).read()
Problem
Writing a python program, and I came up with this error while using the `urllib.urlopen` function. ``` Traceback (most recent call last): File "ChurchScraper.py", line 58, in <module> html = GetAllChurchPages() File "ChurchScraper.py", line 48, in GetAllChurchPages CPs = CPs + urllib.urlopen(url) TypeError: cannot concatenate 'str' and 'instance' objects url = 'http://website.com/index.php?cID=' + str(cID) CPs = CPs + urllib.urlopen(url) ```