What is the use of join() for a string rather than list or tuple method?
Answer Posted / chaitanya
The functions and the methods that are used for the functionality uses the string module. This string module is represented as by using the join function in it:
", ".join(['1', '2', '4', '8', '16']) that results in "1, 2, 4, 8, 16"
The string variable that is used provide a fixed string literal to allow the names that are used to be bounded to the strings. join() is a string method that is used to provide a separator string to use the function over the sequence of the string and insert the function to an adjacent elements. The method uses any number of arguments that follow some rules that has to be put up for the sequence objects that the class defines for itself. The join is used for the string module that is used to join the string characters together as it is given in the program. The example is given as:
string.join(['1', '2', '4', '8', '16'], ", ")
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How would you convert a string into lowercase in python?
What are the benefits of python?
What are the generator functions in python?
What is list comprehension how to define it and when to use?
Where do we use python scripting?
Is javascript harder than python?
What applications can you build with python?
Write a program structure in python?
Is python or r more useful?
What are the two types of functions in python?
Which the command you use to exit help window in python?
How do I define a variable?
How many hours learn python?
Write a regular expression that will accept an email id. Use the re module.
Rules for local and global variables in python?