Gistlib Logo

gistlib

put text in a text in one line in python

To concatenate two or more strings into a single string, you can use the '+' operator.

main.py
text1 = "Hello"
text2 = "World"
text3 = "!"
result = text1 + " " + text2 + text3
print(result)
95 chars
6 lines

Output: "Hello World!"

You can add any number of strings in a single line by separating them with a '+'.

similar python code snippets

find urls in a string in python
convert a date to a string in python
find the first character in a string in python
convert a string to a date in python
replace the word "dog" with the word "cat" in the following sentence: "the quick brown fox jumps over the lazy dog." in python
find the length of a string in python
find the kth character in a string in python
find the last character in a string in python
generate a password of 8 characters that contains at least one uppercase letter, one lowercase letter, and one number in python
find common prefix in a list of words in python

related categories

python
string-manipulation

gistlibby LogSnag