Python Strings in more than 128 words

In python the strings of characters (Strings) are surrounded by simple quotation marks or double quotation marks, both notations are equivalent. The print feature () allows you to display the number of characters on the screen.

print ("Hello") #notation double quotes and display
print ('Hello') #notation simple quotes
a - "Test" #assignation           

Python offers methods that can be used on String-type objects

a - "Hello, World!"
print(a.upper))) #retourne the chain of character in capital letters   
a - "Hello, World!"
print(a.lower))) #retourne the string of character in tiny
txt - "Hello the world"
x - txt.find ("world")
print(x) #retourne the position of the word you are looking for
a - "Hello, the world!"
(a.replace) #Remplace a chain of character
a - "Hello"
b - "World"
c - a -b
print(c) #Affiche the concatenation of the two character chains
Python gives belonging operators who are used to test whether a sequence is presented in an object:
x - 'Apple and banana'
print ("banana" in x) #Affiche True
print ("pear" not in x) #Affiche True
print ('cherry' in x) #Affiche False

Auteur / autrice

Retour en haut