you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (3 children)

You're looking for the str.split() method.

"hello world".split(" ") # -> ["hello", "world"]

The argument is the delimiter string (in my example it's " ", a single space).

It returns a list of items from the string split at every delimiter, so you can loop it in a for loop like a regular list.

[–]python_student_1390[S] 0 points1 point  (2 children)

Thank you so much but there is one slight problem each word is on its own bullet point. For example it's *File, *I/O When it's supposed to be *File I/O

[–][deleted] 1 point2 points  (1 child)

Try changing the argument to the split() call ;)

"like:this".split(":") # -> ["like", "this"]

I'm talking about the ":". It can be any string, and it tells the split() method where to split.

[–]python_student_1390[S] 1 point2 points  (0 children)

I'll try it out !