How to extract all words from a string in Python

1 Answer

0 votes
s = "python java c c++ c#"
 
words = s.split(" ")
 
print(*words, sep="\n")
 
 
 
'''
run:
 
python
java
c
c++
c#
 
'''

 



answered Feb 9, 2022 by avibootz
edited Apr 8, 2022 by avibootz
...