Give an example for join() and split() funcitons



Give an example for join() and split() funcitons..

Answer / Km Sonit

The `join()` function in Python is used to join the elements of an iterable into a string. The `split()` function splits a string into parts using a specified separator and returns them as a list. Here's an example: `my_list = ['Hello', 'World']`, then `result = ' '.join(my_list)` gives 'Hello World', and `my_string = 'Hello World'`, then `my_list = my_string.split(' ')` results in ['Hello', 'World'].

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What does len () do in python?

1 Answers  


Explain the difference between a list and the tuple?

1 Answers  


What does map function in python do?

1 Answers  


What are the rules for legal python names?

1 Answers  


How do you avoid cyclic imports without resorting to imports in functions?

1 Answers  


What is range() in python? Give an example to explain it.

1 Answers  


What is long in python?

1 Answers  


Are tuples hashable?

1 Answers  


What is the purpose of uuid?

1 Answers  


Is java better than python?

1 Answers  


What is python's slice notation?

1 Answers  


Explain about the programming language python?

1 Answers  


Categories