-2

How can I append numerous items to a list?

I want to avoid doing this:

empty_list = []

empty_list.append('How')
empty_list.append('are')
empty_list.append('you')
2
  • empty_list = ['How', 'are', 'you']? Use list.extend? Also note that empty_list is a bad name once it isn't! Commented Dec 4, 2016 at 18:13
  • by extending it with empty_list.extend([<items>]) Commented Dec 4, 2016 at 18:13

1 Answer 1

1

You can use list.extend:

empty_list = []
empty_list.extend(['How', 'are', 'you'])
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.