Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List slicing issue
#4
(Apr-26-2019, 07:33 PM)Irhcsa Wrote: When I append the items how do I get rid of the blank spaces that show ''?
Check that it's not empty:
for line in inRead:
    name = name.strip()
    if name:
        newList.append(name)
Reply


Messages In This Thread
List slicing issue - by Irhcsa - Apr-26-2019, 06:22 PM
RE: List slicing issue - by ichabod801 - Apr-26-2019, 07:23 PM
RE: List slicing issue - by Irhcsa - Apr-26-2019, 07:33 PM
RE: List slicing issue - by nilamo - Apr-26-2019, 09:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  List Comprehension Issue johnywhy 5 545 Jan-14-2024, 07:58 AM
Last Post: Pedroski55
  Python List Issue Aggie64 5 1,631 Jun-30-2022, 09:15 PM
Last Post: Aggie64
  List to table issue robdineen 2 1,471 Nov-07-2021, 09:31 PM
Last Post: robdineen
  Calculator code issue using list kirt6405 4 2,292 Jun-11-2021, 10:13 PM
Last Post: topfox
  slicing and indexing a list example leodavinci1990 4 2,362 Oct-12-2020, 06:39 AM
Last Post: bowlofred
  Issue accessing data from Dictionary/List in the right format LuisSatch 2 2,224 Jul-25-2020, 06:12 AM
Last Post: LuisSatch
  For List Loop Issue Galdain 2 2,055 Dec-31-2019, 04:53 AM
Last Post: Galdain
  Help with slicing a list FWendeburg 3 2,600 Dec-02-2019, 04:57 PM
Last Post: michael1789
  IndexError: List index out of range issue Adem 1 3,544 Nov-01-2019, 10:47 PM
Last Post: ichabod801
  List/String seperation issue YoungGrassHopper 13 5,520 Sep-20-2019, 11:57 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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