Python Forum

Full Version: Cant Append a word in a line to a list err "str obj has no attribute append
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey everyone,

I am trying to get every word in line to a list however i am getting error " AttributeError: 'str' object has no attribute 'append'". Any ideas are welcome, thanks in advance.

if satırsayısı2==isimsatırlistesi[0]:
        for word in line2:
            word.append(str(adressatırı)) #[b]AttributeError: 'str' object has no attribute 'append'[/b]
            satırdakikelimesayısı=len(adressatırı)
            print(adressatırı[2:satırdakikelimesayısı])
wrd=[]
if satırsayısı2==isimsatırlistesi[0]:
        for word in line2:
            wrd.append(str(adressatırı)) 
            satırdakikelimesayısı=len(adressatırı)
            print(adressatırı[2:satırdakikelimesayısı])
entireLine=",".join(wrd)
You have not supplied enough information. What is line2? What is adressatiri? What are your trying to do with this:
word.append(str(adressatırı))