-4

I want to display a 2D list without brackets, commas, or any stuffs. I printed the content of the list using the following code:

print(ncA_string[a][0],ncA_string[a][1],ncA_string[a][2],ncA_string[a][3]) 

Unfortunately, however, it is showing the commas, and brackets. Here's the picture of the output

I wanna display it like this: ((((((ab)c)d)e)

I'm new to using python and I've tried using the join map but i couldn't understand it yet.

Can anyone teach me how to??

Thank you so much :))

Julien
  • 13,986
  • 5
  • 29
  • 53
  • 2
    Maybe try a little research first? I googled "print a python list", which includes [this question](https://stackoverflow.com/questions/5445970/printing-list-in-python-properly), the answers to which have several examples that may point you in the right direction. – larsks Sep 06 '16 at 02:20
  • @larsks what your said, was really the same thing as a LGTFY link: http://meta.stackoverflow.com/questions/255397/lmgtfy-link-cant-be-added. And those are considered rude, and impolite. Yes, he could have just googled the question, but you didn't have to tell him like that. Let's be nice, K? – Christian Dean Sep 06 '16 at 03:28
  • Mr. Gooseberry, I see you're not terribly familiar with stackoverflow. One of the things we ask is that people try to solve problems on their own *first*, and come here with specific technical questions ("My code looks like this, and while I expect `<`this output`>`, instead I get `<`this error`>`) rather than broad, "write my code for me" questions. There are other places to go if you want people to write your code *for* you. – larsks Sep 06 '16 at 12:55

1 Answers1

0

You need to flatten ncA_string[a] first. Try to use flatten function from this answer https://stackoverflow.com/a/12472461/1112457 . Then you can unpack the flattened list as arguments to the print function:

print(*flatten(ncA_string[a]))

or if you want to print it without spaces:

print(''.join(flatten(ncA_string[a])))
Community
  • 1
  • 1
gavriel
  • 335
  • 2
  • 10