Python Forum
Undo interation to make a single list?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Undo interation to make a single list?
#3
(Nov-28-2020, 09:43 PM)bowlofred Wrote: You're printing each one separately. Instead, you can append them to a list.

title_list = []
for submission in reddit.subreddit('finance').hot(limit=50):
    titles = submission.title.replace("\n", " ")
    title_list.append(titles)
print(title_list)
# or....
print(",".join(title_list))


Thank you, that works!
Reply


Messages In This Thread
RE: Undo interation to make a single list? - by DustinKlent - Nov-29-2020, 03:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why do I have to repeat items in list slices in order to make this work? Pythonica 7 1,341 May-22-2023, 10:39 PM
Last Post: ICanIBB
  help me to make my password list in python >>> Oktay34riza 0 583 Dec-23-2022, 12:38 PM
Last Post: Oktay34riza
  Make Groups with the List Elements quest 2 1,977 Jul-11-2021, 09:58 AM
Last Post: perfringo
  Parse String between 2 Delimiters and add as single list items lastyle 5 3,367 Apr-11-2021, 11:03 PM
Last Post: lastyle
Question How to make a 3D List of Excel Spreadsheets? chatguy 4 2,754 Jan-24-2021, 05:24 AM
Last Post: buran
  convert List with dictionaries to a single dictionary iamaghost 3 2,874 Jan-22-2021, 03:56 PM
Last Post: iamaghost
  How to append multiple <class 'str'> into a single List ahmedwaqas92 2 2,337 Jan-07-2021, 08:17 AM
Last Post: ahmedwaqas92
  How to make global list inside function CHANKC 6 3,108 Nov-26-2020, 08:05 AM
Last Post: CHANKC
  How do i make a new lists out of an list ozezn1 1 1,696 Oct-28-2020, 10:19 PM
Last Post: Gribouillis
  Make list of dates between today back to n days Mekala 3 2,393 Oct-03-2020, 01:01 PM
Last Post: ibreeden

Forum Jump:

User Panel Messages

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