

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to join two strings to convert to a single string in Python?
To join 2 strings in Python, we can use the concatenation operator, '+'. For example:
str1 = "Hello" str2 = "World" str3 = str1 + str2 print str3
This will give us the output:
HelloWorld
We can also use str.join(seq) to join multiple strings together. For example:
s = "-"; seq = ("a", "b", "c"); # This is sequence of strings. print s.join( seq )
This will give us the output:
a-b-c
Note that the str we give is used as the seperator when joining the strings together.
- Related Questions & Answers
- C# program to convert several strings into a single comma-delimited string
- How to convert string Stream to join them in Java?
- How to convert a single character to string in C++?
- How convert an array of Strings in a single String in java?
- How to print a string two times with single statement in Python?
- How to convert byte literals to python strings?
- How to concatenate two strings in Python?
- Twice join of two strings in JavaScript
- How to convert list elements into a single string in R?
- Python program to split and join a string?
- MySQL query to convert a single digit number to two-digit
- How to convert a string to dictionary in Python?
- Program to create a lexically minimal string from two strings in python
- How to convert a single character to its integer value in Python?
- How to join two lists in C#?
Advertisements