0

What is the most memory-efficient way to join a list into a string in MICROPYTHON?

the list object in MICROPYTHON doesn't have the 'join' function, so I would like to know if there's any memory-efficient way to do so

Kishan Patel
  • 778
  • 11
  • 26
Unreality
  • 4,111
  • 11
  • 48
  • 67

2 Answers2

1

As with standard Python, join is a method of strings not of lists. See:

Python join: why is it string.join(list) instead of list.join(string)?

and/or

https://docs.python.org/3/faq/design.html#why-is-join-a-string-method-instead-of-a-list-or-tuple-method

nekomatic
  • 5,988
  • 1
  • 20
  • 27
0

I overlooked, there's indeed a join function from the str class to join the list

e.g.

",".join(["a","b","c"])
Unreality
  • 4,111
  • 11
  • 48
  • 67
  • If this answers your question you should mark it as such, else the question remains unanswered – stijn Aug 26 '19 at 07:29