Python Strings

  • 2 days ago
DEAR SIR/MADAM, I NEED THIS CHANNEL SPONSORSHIP FROM YOU TOO IF POSSIBLE https://www.dailymotion.com/mokkamodina19

DEAR SIR/MADAM, PLEASE ACCEPT AND PERMISSION DAILY MOTION, VIMEO AND RUMBLE.COM IN BANGLADESH.
Mohammad Ali Ashraf, [6/29/2024 7:07 PM]
https://ea.ebs.bankofchina.com/contactUs_en.html

ashrafm703@gmail.com IS MY EMAIL AND
DEAR SIR/MADAM, I NEED SUPPORT AND LOAN FROM CHINESE PRESIDENT AND GOVT.

DEAR SIR/MADAM, I WANT LOAN FROM YOU TO LEARN AND EARN MONEY BY THE SUPER AFFILIATE MARKETING OF JOHN CRESTANI.

DEAR SIR/MADAM.I AM FROM BANGLADESH MY PAYONEER ID IS mokkamodina19@gmail.com , IN ANY BANK ACCOUNTS OF BANGLADESH IS NOT SAFE FOR MY MONEY YOU KNOW THAT. WILL PAYONEER BANK ACCOUNTS OF MINE WILL BE SAFE FOR MY MONEY.? ALL OF MY ASSETS OR PROPERTIES ARE SEIZED BY FAKE WAYS IN BANGLADESH. I WANT TO LOAN FROM YOU TO BUY READYMADE HOUSES OR HOMES FOR ME. ALSO NEED LOANS FROM YOU WORK OR JOB VISA FOR USA/CANADA. ALSO NEED LOAN FROM YOU TO SETTLE AND STUDY IN THE USA/CANADA.. I WANT TO HANDOVER ALL OF MY ASSETS OR PROPERTIES WHICH ARE SEIZED BY FAKE WAYS TO THE USA/CANADA UNIVERSITIES.

https://www.aiddata.org/how-china-lends

mokkamodina19@gmail.com is my payoneer id. i want my youtube channel sponsorship from you.https://www.youtube.com/channel/UCrNbtmpYbyYMgmzD9aPtGMQ
and also help me to monetize my tiktok https://www.tiktok.com/@mohammadaliashr3


AFTER MONETIZATION I WANT THIS LINK SPONSORSHIP FROM YOU TOO. https://rutube.ru/channel/37901720/ ,,,,mokkamodina19@gmail.com is my payoneer id.
Transcript
00:00Hello everyone, welcome to this session, this is about python strings, how strings are important
00:14and what are the different functions of strings, why it is used, all this is incorporated in
00:20this lesson.
00:21So, let us move on.
00:23In python everything is an object and the string is an object too.
00:28So, python strings can be created simply by enclosing the characters in a double quote.
00:34So, anything in a double quote is called as a string.
00:39Now, how we can access values in a string?
00:43Python does not support a character type, these are treated as string length, string
00:49of length 1 also is considered as a substring.
00:53For example, here Grishma variable 1, I am assigning a variable 1 here and assigning
00:59it in a double quote Grishma.
01:00So, that becomes a string here.
01:03So, basically all these which is included in a double quote is called as string.
01:09So, once you execute this program here, you can find out the output of how the variable
01:161 and how the variable 2 is taken as an output, ok.
01:22So, now the various string operators that have been used.
01:25So, in a square bracket, if you are using the operator in a square bracket, it is called
01:32as a slice.
01:33It gives a letter from the given index.
01:37For example, if I am considering the variable, the string Grishma for a variable x.
01:44So, how it can be modified?
01:46Now, a of 1 here will give r from the word guru, ok.
01:52The same way if you are considering Grishma here and for a of 1, it will be given as r
01:59because g will be coming of a of 0, r a of 1, double e a of 2, a of 3.
02:08So, this is how the alignment takes place.
02:11Now, if you are using here this symbol, it gives a slice that is a range slice.
02:17It gives the characters from the given range that is x 1 is to 3, ok.
02:23So, you will get the word r and e.
02:26So, please calculate a 0, a 1, a 2, assign the string variable according to a 0, a 1,
02:34a 2 and from there you can find out where it stands.
02:38Now, if you are using the in operator, membership that is in not in, it is a membership operator.
02:45Now, membership returns here true if a letter exists in a given string.
02:52So, if I am asking the letter r, if it exists in a given string, the in operator is used
02:59here and it will return true.
03:01So, r is present in the word and hence it will give 1 that is true value.
03:08Now, not in that means if the letter is not there in a given string.
03:12So, definitely it will give the value false.
03:16So, if I am using the word l, whether l is present in the word Grishma that means it
03:22will be given as false because the word letter l does not exist in the string Grishma.
03:30Now, small r or the capital R operator, the raw string suppresses your actual meaning
03:38of the escape characters ok.
03:41So, that means you can use the letters in the form of print r cap slash n that is a
03:48space ok.
03:49So, this is how the general example looks like if you are using the raw string operator.
03:55Now, the percentage that is used for the string format ok.
04:01Basically if you are using the percentage r or the percentage s that is a string representation
04:06of canonical string representation, then you have an object oriented string representation,
04:11then you have a format or display of string representation.
04:16For all this we are using the percentage symbol.
04:20So, basically the output here would be Grishma 88 if you are using a d or ns based on that
04:27how you alter your code you will get your output accordingly.
04:31Now, plus is the concatenation of the two strings, this asterisk sign or the multiplications
04:39sign is the repeating of the character twice.
04:42So, if you use it twice you will repeat the string twice.
04:48So, these are the basic various operators that are being used in the string.
04:53Now, how do you replace the strings ok, the string replace method.
04:59The method replace returns a copy of the string copy of a string in which the values of the
05:05old string have been replaced with the new one.
05:10For example, here now the old string here is I like python ok.
05:14Now, I am assigning new string is equal to old string dot replace and what do I want
05:20to replace, I want to replace like with love.
05:24So, what will be the output I love python ok.
05:27So, this is what how you will replace the old string with the new string.
05:34Now, changing the upper and lower case of the string.
05:37So, basically python at uni athena ok, now I want the string this python at uni athena
05:46to be in the form of an upper case.
05:48So, this is the function used here, this is the form syntax form used here print string
05:53dot upper.
05:54So, that python at uni athena will become upper case.
05:59Now, joining of the string ok, bringing of two strings together for that the syntax will
06:05be this join of python and you are using the colon function here.
06:09Now, reversing the string basically 1 2 3 4 5 if you want to reverse it to 5 4 3 2 1,
06:16this is the syntax form used for reversing the string.
06:19Now, splitting ok, strawberry ice cream is awesome.
06:23So, basically if you want to split the strings you will be using this syntax to split the
06:30string.
06:32So, these are all how the different string methods that can be applied, you can replace,
06:38you can use the upper case or lower case, you can join the strings, you can split the
06:42string, you can even reverse the string.
06:45So, these are the syntaxes that you need to know when you are using the replacing or any
06:51methods of your form.
06:53Now, python string strip function ok, the python string strip function is a part of
07:00built in function available in python library, this is already available in python library.
07:07Now, the strip method removes given characters from start and end of the original string.
07:15By default the strip function removes the white spaces from the start and end of the
07:20string and returns the same string without white spaces ok.
07:25So, basically without white spaces the string that you have been given as input will the
07:31same out the same string comes as output, only thing is the white spaces have been removed.
07:37Now, this is how the string the character syntax looks like, string dot strip and the
07:44characters.
07:45Now, the parameters that are being used, the character here is an option, the given characters
07:50will be removed from the start or end of the original string.
07:55If the character parameter is not given the white spaces from the start and the end of
08:00the string will be removed.
08:02So, these all you need to try in your program, so that you will understand how to use it.
08:08Now, why this strip function is used ok, it helps to remove the characters at the start
08:15of the string and also the end of the string based on the characters given to be removed
08:21from the original string ok.
08:24Now, if the character do not match with the original string, the string will be returned
08:30as it is.
08:31Now, if the character to be removed are not specified, if you are not specifying the character
08:36to be removed, white spaces from the start and the end of the original string will be
08:42removed.
08:43Now, if there is no white spaces at the start or end of the string, then the string will
08:49be returned as it is.
08:50So, these are the reasons why you have to use the strip function in a python.
08:56Now, python string count, the count function ok, the count function is a built in function
09:02again in a python, it will return the total count of a given element in a string.
09:09The counting begins basically from the start and ends at the end.
09:13Now, it is also possible to specify the start and end index of the string, so from where
09:19you want to start or begin your search.
09:22So, this is the syntax of the python string count, string dot count that is character
09:29or substring, then you specify your start and you specify your end.
09:34So, this is the python string count.
09:37Now, parameters of this python string count is we can use character or substring, we can
09:44specify a single character or a substring which we want to search in a given string
09:51ok.
09:52It will return the count of the character or the substring in the given character.
09:56So, basically it returns the count of the character or the substring count of a given
10:04element in a string.
10:06The counting begins basically from the start and ends at the end.
10:10Now, it is also possible to specify the start and end index of the string, so from where
10:17you want to start or begin your search.
10:19So, this is the syntax of the python string count, string dot count that is character
10:26or substring, then you specify your start and you specify your end.
10:31So, this is the python string count.
10:35Now, parameters of this python string count is we can use character or substring, we can
10:41specify a single character or a substring which we want to search in a given string
10:48ok.
10:49It will return the count of the character or the substring in the given character.
10:53So, basically it returns the count of the character or the substring in a given string.
10:58Now, start here is of course an optional, it indicates the start index from where the
11:05search will begin ok.
11:06If not given, it will start from 0 itself.
11:09Now, end is again an optional here, it indicates the end index where the search end ok, even
11:16if you do not give it will come to the list or the string given.
11:21Now, what is this return value?
11:23The count method will return an integer value that is the count of the given element from
11:29the given string.
11:31It returns a 0 if the value is not found in the given string.
11:37Now, the python string format here is a function which is used to replace, substitute or convert
11:44the string with placeholders with the valid values in the final string.
11:50So, string formatting is basically you can replace, you can substitute or convert.
11:55Now, again this is a built in function for the python string class which returns the
12:00formatted string as an output.
12:02Now, placeholders inside the string are defined in the form of curly braces ok.
12:07So, this is the syntax for the python string format.
12:12Now, python string length or the len which we call.
12:17Now, the len function is again a built in function in python.
12:21We can use this len function to give the, to get the length of the given string that
12:26is array, list, tuple, dictionary etcetera.
12:30So, wherever you use the len format, you can find out the length of the given string.
12:36Now, we can use the len function to optimize the performance of the program.
12:41It helps us to optimize the performance of the program.
12:44Now, the number of elements here stored in the object is never calculated.
12:49Always remember the element stored in an object is never calculated.
12:53So, the len helps us to provide the number of elements.
12:57So, this is how the syntax looks like len and the value.
13:02Now, what are the parameters here?
13:04The value is given value you want the length of ok and it returns the value.
13:10It will return an integer value that is which is the length of the given string or array
13:17or a list of collections.
13:18Now, there are various types of return values as well.
13:23Now, the first one is string itself.
13:26It returns the number of characters in a string which includes punctuation, space and all
13:33types of special characters and of course, you should be very careful when you are using
13:37the null variable.
13:38Now, next one is empty.
13:39Empty is basically a second return call which has 0 characters and it will always be null.
13:46Now, collection the length built in returns the number of elements in the collection.
13:51Now, if you are using the type error length function depends on the type of variable passed
13:57ordered ok a non type does not have any built in support.
14:01Now, if you are giving a dictionary for dictionary each pair is counted as one unit.
14:06However, values and the keys are not independent ok.
14:11So, these are the features that you need to consider when you are using the python string
14:16length.
14:18Now, python string find the find function.
14:21Now, again this is a function which is available in python library to find the index of the
14:28first occurrence of a substring for a given string.
14:32Now, the string find function will return this instead of throwing an exception ok.
14:38If the specified substring is not present in the given string ok.
14:43Always remember if it is returning the value minus 1 that means, it is throwing an exception.
14:49Now, the syntax here is string dot find that is the substring with starts and end.
14:56Now, substring is the substring you want to search in the given string start is basically
15:02from where you want the search option to start and end is definitely where the search of
15:08the substring will end.
15:10So, this is how the string find function works.
15:13So, with this we conclude this session.
15:16Thank you so much.
15:17And end is definitely where the search of the substring will end.
15:21So, this is how the string find function works.