Python Forum
Cant Append a word in a line to a list err "str obj has no attribute append
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cant Append a word in a line to a list err "str obj has no attribute append
#1
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ı])
Reply
#2
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)
Reply
#3
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ı))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to append multiple <class 'str'> into a single List ahmedwaqas92 2 158 Jan-07-2021, 08:17 AM
Last Post: ahmedwaqas92
  Add a row to a dataframe or append whole dataframe. tsurubaso 1 122 Jan-07-2021, 01:53 AM
Last Post: tsurubaso
  Trying to get the first letter of every word in a list DanielCook 2 141 Jan-05-2021, 05:06 PM
Last Post: deanhystad
  Append 2d empty lists NMMST 2 196 Oct-19-2020, 09:25 PM
Last Post: NMMST
  How to append to a set in Python dgrunwal 7 374 Oct-01-2020, 04:27 PM
Last Post: ndc85430
  Passing List of Objects in Command Line Python usman 7 550 Sep-27-2020, 03:45 PM
Last Post: ndc85430
  How to append to list a function output? rama27 5 392 Aug-24-2020, 10:53 AM
Last Post: DeaD_EyE
  Including modules in Python using sys.path.append JoeDainton123 1 415 Aug-24-2020, 04:51 AM
Last Post: millpond
  How to create and define in one line a 2D list of class objects in Python T2ioTD 1 291 Aug-14-2020, 12:37 PM
Last Post: Yoriz
  Trying to find first 2 letter word in a list of words Oldman45 7 522 Aug-11-2020, 08:59 AM
Last Post: Oldman45

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020