1

I want to print tabulated list, but I can't tabulate first member of list.

list = ['data', 'data','data']
print(*list, sep='\n \t')

But I get:

data  
    data  
    data  

I would like to get:

    data  
    data  
    data 

How to tabulate first member?

4
  • 1
    print (list[0]) ? I really don't understand your problem, what is your desired output? Commented May 14, 2016 at 14:10
  • Sorry, I kinda failed to explain properly. Now I edited post Commented May 14, 2016 at 14:19
  • 1
    What does ----- means? Commented May 14, 2016 at 14:22
  • I didn't knew how to tabulate lines in this site. - represents just space. Sorry, will look into formatting of posts. Commented May 14, 2016 at 14:27

1 Answer 1

2

Did you mean this,

l = ['data', 'data','data']
s = '\n'.join(['\t'+item for item in l])

print(s)
# Ouput
    data
    data
    data
Sign up to request clarification or add additional context in comments.

4 Comments

I'm very new to this site I failed to format my post the way I wanted. Only now I edited the way I want. With a little changes I got what I wanted. Thanks !
@SoulJam, ---- is \t in your case?
Yes. I Haven't learnt fully how to operate on this site. Sorry, next time I will format properly.
@SoulJam, don't worry. Every expert was once a beginner.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.