Python Forum
List/String seperation issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List/String seperation issue
#8
(Sep-20-2019, 07:57 AM)YoungGrassHopper Wrote: I am struggling with getting the chunks joined in list form after they get divided in workable chunks of [['A','A','A'],['B','B','B'],['C','C','C']]

I need to get them like this : [['AAA'],['BBB'],['CCC']]
I tried ''.join(chunks) but to luck

My personal feeling is that you should clearly articulate (in spoken language) what you want achieve and then start to implement steps to reach your goal. Do you really need this structure? Not that this is particularly hard to implement (you need to add pair of squared brackets) but why you need it?

chunks = [[dna[y-x:y]] 
          for y in range(x, len(dna)+x, x) 
          if len(dna[y-x:y]) == 3]
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
List/String seperation issue - by YoungGrassHopper - Sep-19-2019, 01:56 PM
RE: List/String seperation issue - by ichabod801 - Sep-19-2019, 01:58 PM
RE: List/String seperation issue - by perfringo - Sep-20-2019, 06:33 AM
RE: List/String seperation issue - by perfringo - Sep-20-2019, 08:05 AM
RE: List/String seperation issue - by perfringo - Sep-20-2019, 08:47 AM
RE: List/String seperation issue - by perfringo - Sep-20-2019, 11:17 AM
RE: List/String seperation issue - by perfringo - Sep-20-2019, 11:57 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  List Comprehension Issue johnywhy 5 575 Jan-14-2024, 07:58 AM
Last Post: Pedroski55
  Python List Issue Aggie64 5 1,690 Jun-30-2022, 09:15 PM
Last Post: Aggie64
  List to table issue robdineen 2 1,482 Nov-07-2021, 09:31 PM
Last Post: robdineen
  Last caracter of a string truncated issue when working from the end of the string Teknohead23 3 1,620 Oct-03-2021, 01:08 PM
Last Post: snippsat
  Calculator code issue using list kirt6405 4 2,316 Jun-11-2021, 10:13 PM
Last Post: topfox
  Issue accessing data from Dictionary/List in the right format LuisSatch 2 2,252 Jul-25-2020, 06:12 AM
Last Post: LuisSatch
  connection string issue racone 2 3,781 Feb-03-2020, 02:22 AM
Last Post: racone
  For List Loop Issue Galdain 2 2,091 Dec-31-2019, 04:53 AM
Last Post: Galdain
  Python C API - Issue with string as arugments JRHeisey 2 2,824 Nov-30-2019, 04:53 AM
Last Post: casevh
  IndexError: List index out of range issue Adem 1 3,567 Nov-01-2019, 10:47 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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