join()

my_str.join()
Returns a string after joining elements of any iterable object using any delimiter.

We will use list, dictionary, tuple, set string in our examples.
my_list=['Alex','Ronald','John']
output='*'.join(my_list)
print(output) #  Alex*Ronald*John

my_tuple=('Alex','Ronald','John')
output='#'.join(my_tuple)
print(output) #  Alex#Ronald#John

my_set={'Alex','Ronald','John'}
output=' '.join(my_set)
print(output) #  Alex Ronald John

my_dict={'a':'Alex','b':'Ronald','c':'John'}
output='%'.join(my_dict)
print(output) #  a%b%c ( only keys are present ( not values )) 

my_str='plus2net'
output='*'.join(my_str)
print(output)  # p*l*u*s*2*n*e*t
All String methods



plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer