목록을 문자열 파이썬으로 변환

코드 예제

5
0

문자열에 파이썬 배열

mystring = 'hello, world'

myarray = string1.split(', ') #output => [hello, world]

myjoin1 = ', '.join(myarray) #output => hello, world
myjoin2 = ' '.join(myarray) #output => hello world
myjoin3 = ','.join(myarray) #output => hello,world
4
0

파이썬 문자열 목록

>>> L = [1,2,3]       
>>> " ".join(str(x) for x in L)
'1 2 3'
0
0

문자열에 파이썬 목록

# Python list to string

some_list = ['Bob', 'has', 'four', 'dogs'] # the base list

list_to_string = ' '.join(some_list) # using the join() we can join the list into a string
# the ' ' in the start is the way we want to connect the list
# if we will do '/' the string will look like Bob/has/four/dogs

print(list_ro_string) # Prints the string

===============================================================
# Output:

>>> 'Bob has four dogs'

다른 언어로

이 페이지는 다른 언어로되어 있습니다

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