0

How would I convert a string into a table in python? Example:

s = "hello"
s.TurnIntoTable -> s = ["h","e","l","l","o"]

2 Answers2

0

list(s)

should do what your asking

or maybe

[list(line) for line in s.splitlines()]

Joran Beasley
  • 110,522
  • 12
  • 160
  • 179
0

Simple turn it to a list:

s = "hello"
print( list(s) )

#['h', 'e', 'l', 'l', 'o']
Andre
  • 3
  • 3
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 11 '22 at 05:50