Python Forum
Cant Append a word in a line to a list err "str obj has no attribute append - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Cant Append a word in a line to a list err "str obj has no attribute append (/thread-26145.html)



Cant Append a word in a line to a list err "str obj has no attribute append - Sutsro - Apr-22-2020

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ı])



RE: Cant Append a word in a line to a list err "str obj has no attribute append - anbu23 - Apr-22-2020

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)



RE: Cant Append a word in a line to a list err "str obj has no attribute append - deanhystad - Apr-22-2020

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ı))