Diferència entre revisions de la pàgina «Mètodes de cadenes a Python»

De binefa.com
Salta a la navegació Salta a la cerca
(Es crea la pàgina amb «Alguns dels mètodes que ofereixen les cadenes són: '''capitalize()''' – Canvia totes les lletres de cadena a majúscules. '''center()''' – centra la cadena din...».)
 
m
Línia 7: Línia 7:
 
'''count()''' – compta el nombre de cops que hi apareix a una cadena un caràcter donat.
 
'''count()''' – compta el nombre de cops que hi apareix a una cadena un caràcter donat.
  
join() – joins all items of a tuple/list into one string;
+
Alguns dels mètodes que ofereixen les cadenes són:
 +
 
 +
'''capitalize()''' – Canvia totes les lletres de cadena a majúscules.
 +
 
 +
'''center()''' – centra la cadena dins del camp d'una longitud coneguda.
 +
 
 +
'''count()''' – compta el nombre de cops que hi apareix a una cadena un caràcter donat.
 +
 
 +
Alguns dels mètodes que ofereixen les cadenes són:
 +
 
 +
'''capitalize()''' – Canvia totes les lletres de cadena a majúscules.
 +
 
 +
'''center()''' – centra la cadena dins del camp d'una longitud coneguda.
 +
 
 +
'''count()''' – compta el nombre de cops que hi apareix a una cadena un caràcter donat.
 +
 
 +
Alguns dels mètodes que ofereixen les cadenes són:
 +
 
 +
'''capitalize()''' – Canvia totes les lletres de cadena a majúscules.
 +
 
 +
'''center()''' – centra la cadena dins del camp d'una longitud coneguda.
 +
 
 +
'''count()''' – compta el nombre de cops que hi apareix a una cadena un caràcter donat.
 +
 
 +
join()Alguns dels mètodes que ofereixen les cadenes són:
 +
 
 +
'''capitalize()''' – Canvia totes les lletres de cadena a majúscules.
 +
 
 +
'''center()''' – centra la cadena dins del camp d'una longitud coneguda.
 +
 
 +
'''count()''' – compta el nombre de cops que hi apareix a una cadena un caràcter donat.
 +
 
 +
'''join()''' – uneix tots els elements d'una tupla/llista en una sola cadena.
 +
 
 +
'''lower()''' – converteix totes les lletres de la cadena en lletres minúscules.
 +
 
 +
'''lstrip()''' – elimina els caràcters blancs del començament de la cadena.
 +
 
 +
'''replace()''' –  substitueix una subcadena donada per una altra.
 +
 
 +
'''rfind()''' – troba una subcadena que comença des del final de la cadena;.
 +
 
 +
'''rstrip()''' – elimina els espais en blanc finals del final de la cadena.
 +
 
 +
'''split()''' – divideix la cadena en una subcadena emprant un delimitador donat.
 +
 
 +
'''strip()''' – elimina els espais en blanc inicials i finals.
 +
 
 +
'''swapcase()''' – Intercanvia les majúscules per minúscules i viceversa.
 +
 
 +
'''title()''' – fa la primera lletra en cada paraula en majúscules.
 +
 
 +
'''upper()''' – converteix totes les lletres de la cadena en majúscules.
 +
 
 +
2. String content can be determined using the following methods (all of them return Boolean values):
 +
 
 +
endswith() – does the string end with a given substring?
 +
isalnum() – does the string consist only of letters and digits?
 +
isalpha() – does the string consist only of letters?
 +
islower() – does the string consists only of lower-case letters?
 +
isspace() – does the string consists only of white spaces?
 +
isupper() – does the string consists only of upper-case letters?
 +
startswith() – does the string begin with a given substring? – joins all items of a tuple/list into one string;
 +
lower() – converts all the string's letters into lower-case letters;
 +
lstrip() – removes the white characters from the beginning of the string;
 +
replace() – replaces a given substring with another;
 +
rfind() – finds a substring starting from the end of the string;
 +
rstrip() – removes the trailing white spaces from the end of the string;
 +
split() – splits the string into a substring using a given delimiter;
 +
strip() – removes the leading and trailing white spaces;
 +
swapcase() – swaps the letters' cases (lower to upper and vice versa)
 +
title() – makes the first letter in each word upper-case;
 +
upper() – converts all the string's letter into upper-case letters.
 +
 
 +
2. String content can be determined using the following methods (all of them return Boolean values):
 +
 
 +
endswith() – does the string end with a given substring?
 +
isalnum() – does the string consist only of letters and digits?
 +
isalpha() – does the string consist only of letters?
 +
islower() – does the string consists only of lower-case letters?
 +
isspace() – does the string consists only of white spaces?
 +
isupper() – does the string consists only of upper-case letters?
 +
startswith() – does the string begin with a given substring?join() – joins all items of a tuple/list into one string;
 +
lower() – converts all the string's letters into lower-case letters;
 +
lstrip() – removes the white characters from the beginning of the string;
 +
replace() – replaces a given substring with another;
 +
rfind() – finds a substring starting from the end of the string;
 +
rstrip() – removes the trailing white spaces from the end of the string;
 +
split() – splits the string into a substring using a given delimiter;
 +
strip() – removes the leading and trailing white spaces;
 +
swapcase() – swaps the letters' cases (lower to upper and vice versa)
 +
title() – makes the first letter in each word upper-case;
 +
upper() – converts all the string's letter into upper-case letters.
 +
 
 +
2. String content can be determined using the following methods (all of them return Boolean values):
 +
 
 +
endswith() – does the string end with a given substring?
 +
isalnum() – does the string consist only of letters and digits?
 +
isalpha() – does the string consist only of letters?
 +
islower() – does the string consists only of lower-case letters?
 +
isspace() – does the string consists only of white spaces?
 +
isupper() – does the string consists only of upper-case letters?
 +
startswith() – does the string begin with a given substring?join() – joins all items of a tuple/list into one string;
 +
lower() – converts all the string's letters into lower-case letters;
 +
lstrip() – removes the white characters from the beginning of the string;
 +
replace() – replaces a given substring with another;
 +
rfind() – finds a substring starting from the end of the string;
 +
rstrip() – removes the trailing white spaces from the end of the string;
 +
split() – splits the string into a substring using a given delimiter;
 +
strip() – removes the leading and trailing white spaces;
 +
swapcase() – swaps the letters' cases (lower to upper and vice versa)
 +
title() – makes the first letter in each word upper-case;
 +
upper() – converts all the string's letter into upper-case letters.
 +
 
 +
2. String content can be determined using the following methods (all of them return Boolean values):
 +
 
 +
endswith() – does the string end with a given substring?
 +
isalnum() – does the string consist only of letters and digits?
 +
isalpha() – does the string consist only of letters?
 +
islower() – does the string consists only of lower-case letters?
 +
isspace() – does the string consists only of white spaces?
 +
isupper() – does the string consists only of upper-case letters?
 +
startswith() – does the string begin with a given substring?join() – joins all items of a tuple/list into one string;
 
lower() – converts all the string's letters into lower-case letters;
 
lower() – converts all the string's letters into lower-case letters;
 
lstrip() – removes the white characters from the beginning of the string;
 
lstrip() – removes the white characters from the beginning of the string;

Revisió del 10:30, 9 ago 2024

Alguns dels mètodes que ofereixen les cadenes són:

capitalize() – Canvia totes les lletres de cadena a majúscules.

center() – centra la cadena dins del camp d'una longitud coneguda.

count() – compta el nombre de cops que hi apareix a una cadena un caràcter donat.

Alguns dels mètodes que ofereixen les cadenes són:

capitalize() – Canvia totes les lletres de cadena a majúscules.

center() – centra la cadena dins del camp d'una longitud coneguda.

count() – compta el nombre de cops que hi apareix a una cadena un caràcter donat.

Alguns dels mètodes que ofereixen les cadenes són:

capitalize() – Canvia totes les lletres de cadena a majúscules.

center() – centra la cadena dins del camp d'una longitud coneguda.

count() – compta el nombre de cops que hi apareix a una cadena un caràcter donat.

Alguns dels mètodes que ofereixen les cadenes són:

capitalize() – Canvia totes les lletres de cadena a majúscules.

center() – centra la cadena dins del camp d'una longitud coneguda.

count() – compta el nombre de cops que hi apareix a una cadena un caràcter donat.

join()Alguns dels mètodes que ofereixen les cadenes són:

capitalize() – Canvia totes les lletres de cadena a majúscules.

center() – centra la cadena dins del camp d'una longitud coneguda.

count() – compta el nombre de cops que hi apareix a una cadena un caràcter donat.

join() – uneix tots els elements d'una tupla/llista en una sola cadena.

lower() – converteix totes les lletres de la cadena en lletres minúscules.

lstrip() – elimina els caràcters blancs del començament de la cadena.

replace() – substitueix una subcadena donada per una altra.

rfind() – troba una subcadena que comença des del final de la cadena;.

rstrip() – elimina els espais en blanc finals del final de la cadena.

split() – divideix la cadena en una subcadena emprant un delimitador donat.

strip() – elimina els espais en blanc inicials i finals.

swapcase() – Intercanvia les majúscules per minúscules i viceversa.

title() – fa la primera lletra en cada paraula en majúscules.

upper() – converteix totes les lletres de la cadena en majúscules.

2. String content can be determined using the following methods (all of them return Boolean values):

endswith() – does the string end with a given substring? isalnum() – does the string consist only of letters and digits? isalpha() – does the string consist only of letters? islower() – does the string consists only of lower-case letters? isspace() – does the string consists only of white spaces? isupper() – does the string consists only of upper-case letters? startswith() – does the string begin with a given substring? – joins all items of a tuple/list into one string; lower() – converts all the string's letters into lower-case letters; lstrip() – removes the white characters from the beginning of the string; replace() – replaces a given substring with another; rfind() – finds a substring starting from the end of the string; rstrip() – removes the trailing white spaces from the end of the string; split() – splits the string into a substring using a given delimiter; strip() – removes the leading and trailing white spaces; swapcase() – swaps the letters' cases (lower to upper and vice versa) title() – makes the first letter in each word upper-case; upper() – converts all the string's letter into upper-case letters.

2. String content can be determined using the following methods (all of them return Boolean values):

endswith() – does the string end with a given substring? isalnum() – does the string consist only of letters and digits? isalpha() – does the string consist only of letters? islower() – does the string consists only of lower-case letters? isspace() – does the string consists only of white spaces? isupper() – does the string consists only of upper-case letters? startswith() – does the string begin with a given substring?join() – joins all items of a tuple/list into one string; lower() – converts all the string's letters into lower-case letters; lstrip() – removes the white characters from the beginning of the string; replace() – replaces a given substring with another; rfind() – finds a substring starting from the end of the string; rstrip() – removes the trailing white spaces from the end of the string; split() – splits the string into a substring using a given delimiter; strip() – removes the leading and trailing white spaces; swapcase() – swaps the letters' cases (lower to upper and vice versa) title() – makes the first letter in each word upper-case; upper() – converts all the string's letter into upper-case letters.

2. String content can be determined using the following methods (all of them return Boolean values):

endswith() – does the string end with a given substring? isalnum() – does the string consist only of letters and digits? isalpha() – does the string consist only of letters? islower() – does the string consists only of lower-case letters? isspace() – does the string consists only of white spaces? isupper() – does the string consists only of upper-case letters? startswith() – does the string begin with a given substring?join() – joins all items of a tuple/list into one string; lower() – converts all the string's letters into lower-case letters; lstrip() – removes the white characters from the beginning of the string; replace() – replaces a given substring with another; rfind() – finds a substring starting from the end of the string; rstrip() – removes the trailing white spaces from the end of the string; split() – splits the string into a substring using a given delimiter; strip() – removes the leading and trailing white spaces; swapcase() – swaps the letters' cases (lower to upper and vice versa) title() – makes the first letter in each word upper-case; upper() – converts all the string's letter into upper-case letters.

2. String content can be determined using the following methods (all of them return Boolean values):

endswith() – does the string end with a given substring? isalnum() – does the string consist only of letters and digits? isalpha() – does the string consist only of letters? islower() – does the string consists only of lower-case letters? isspace() – does the string consists only of white spaces? isupper() – does the string consists only of upper-case letters? startswith() – does the string begin with a given substring?join() – joins all items of a tuple/list into one string; lower() – converts all the string's letters into lower-case letters; lstrip() – removes the white characters from the beginning of the string; replace() – replaces a given substring with another; rfind() – finds a substring starting from the end of the string; rstrip() – removes the trailing white spaces from the end of the string; split() – splits the string into a substring using a given delimiter; strip() – removes the leading and trailing white spaces; swapcase() – swaps the letters' cases (lower to upper and vice versa) title() – makes the first letter in each word upper-case; upper() – converts all the string's letter into upper-case letters.

2. String content can be determined using the following methods (all of them return Boolean values):

endswith() – does the string end with a given substring? isalnum() – does the string consist only of letters and digits? isalpha() – does the string consist only of letters? islower() – does the string consists only of lower-case letters? isspace() – does the string consists only of white spaces? isupper() – does the string consists only of upper-case letters? startswith() – does the string begin with a given substring?