--Originally published at Hackerman's house
We already have seen that there are a lot of basic types of data in python. In this case we’ll be using strings. Strings allow us to save a series of letters or numbers, in this case the numbers won’t be treated like numbers, just as a character, so we won’t be able to perform mathematical operations with them.
To define a string we have to use quotation “” or ”.
example = “Paco”
example2 = ‘Marquez’
We can analyze this information using several python functions. To calculate the lenght we do this.
print len(example)
We can also concatenate two strings.
Concatenation = example + example2
print(Concatenation)
This would print PacoMarquez.
We can also repeat a string.
Repetition = example * 2
Also we can obtain a specific character included in the string.
nombre = ‘Francisco’
print nombre[0]
That is the basic information about strings that I will give today, but I have to recognize that there are a lot of things that can be done with this type of data.
Got some nice information here: https://www.tutorialspoint.com/python3/python_strings.htm