Rozdělit do slov python

Příklady kódu

27
0

N

foo = "A B C D"
bar = "E-F-G-H"

# the split() function will return a list
foo_list = foo.split()
# if you give no arguments, it will separate by whitespaces by default
# ["A", "B", "C", "D"]

bar_list = bar.split("-", 3)
# you can specify the maximum amount of elements the split() function will output
# ["E", "F", "G"]
7
0

N

sentence = 'Hello world a b c'
split_sentence = sentence.split(' ')
print(split_sentence)
7
0

N

l = list('abcd')  	        # ['a', 'b', 'c', 'd']
l = map(None, 'abcd')       # ['a', 'b', 'c', 'd']
l = [i for i in 'abcd']	    # ['a', 'b', 'c', 'd']

import re               # importing regular expression module
l = re.findall('.', 'abcd')
print(l)                	# ['a', 'b', 'c', 'd']
1
0

N

>>> "MATCHES__STRING".split("__")
['MATCHES', 'STRING']

V jiných jazycích

Tato stránka je v jiných jazycích

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................