RUVIDEO
Поделитесь видео 🙏

Python Tutorial: How To Concatenate in Python? #45

See our full tutorial at http://learnpythontutorial.com/how-to-concatenate-in-python/
How to Concatenate in Python?
In this Python tutorial, we will look at how to concatenate in Python. There are occasions when we would want to combine one or more strings together and this is called concatenation in programming. We can perform concatenation in Python by adding a plus(+) symbol between strings. When we concatenate you may want to plan ahead and add a space at the end of the first string or add a space at the beginning of the second string otherwise our strings will be combined with no space. Another solution would be to create another string that contains a space.

Examples of Concatenation in Python
#Combine two strings notice space in the beginning of second string
'This is the first string' + ' This is the second string'
'This is the first string This is the second string'

#Adding a space in concatenation
'We can also add a space to a string like this' + ' ' + 'Now we have a space'
'We can also add a space to a string like this Now we have a space'

# Concatenating variables but notice no space fix that in the next example
a = 'This is the first string'
b = 'This is the second string'
print(a + b)
This is the first stringThis is the second string

#Fixing the space from the above example
a = 'This is the first string'
b = 'This is the second string'
c = ' ' #there is a space in this string
print(a + c + b)
This is the first string This is the second string

#How about making a new object for future use
d = a + c + b
print(d)
This is the first string This is the second string
We can not concatenate a string to any other type of object on strings. For example we cannot concatenate a string 'This is a string' + 9 this will return an error. In this case we would need to convert the 9 integer to a string for the concatenation to work. Look at the example below.

a = 'This is a string'
b = 9
a + b
Traceback (most recent call last):
File "stdin", line 1, in module
TypeError: Can't convert 'int' object to str implicitly
a + str(b)
'This is a string9'
If you have any questions about how to concatenate in Python leave a comment below and we will help you out.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Tutorial: How To Concatenate in Python? #45», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.