1

I am trying to append items into lists of list but instead i am getting an equivalent of extend().

doc = __doc__
result = []

collector = FilteredWorksetCollector(doc)
user_worksets = collector.OfKind(WorksetKind.UserWorkset)
for i in user_worksets:
    result.append(i.Name)
    result.append(i.Kind)
OUT = result

I would like to get a list that looks like this: [[name, name, name],[kind, kind, kind]]

thank you,

1 Answer 1

4
OUT = [[i.Name for i in user_worksets], [i.Kind for i in user_worksets]]
Sign up to request clarification or add additional context in comments.

Comments

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.