본문 바로가기

반응형

전체 글

(1576)
String Formatting With String.Format Method in Python Another way to format strings is the string.format method.This method indicates the places we want to change on a sting with curly braces.For example, there is a variable named Linkedin below, and two sections are left blank with curly braces.We pill place values in these sections wiht the string.format method. So how do we do it?  We write the variable we want to format. Then we call the format..
String Formatting With String.Format Method in Python Another way to format strings is the string.format method.This method indicates the places we want to change on a string with curly braces.For example, there is a variable named Linkedin below, and two sections are left blank with curly braces.We will place values in these sections with the string.format method. So how we do it?  We write the variable we want to format. Then we call the format m..
String Formatting With % Operator in Python The format is a method that helps us insert a variable or value anywhere in a string expression.We can format using the percent sign.For example, there is a sentence below. We would like to leave the blank in this sentence anonymous.In other words, we do not want this empty part to remain costant ; we want to fill it with the vlaue we want in the next step. So how do we do this?  If we want to s..
String Formatting with Arithmetic Operations in Python We have learned in our previous lessons that we can perform arithmetic operations on string values.However, we should not have thought of these arithmetic operations mathematically.For example, aggregation was used to concatenate string values. You can also do this collection as follows:You can perform your operations from a shortcut by using the arithmetic operator before "equals". You can perf..
Complex Indexing and Slicing Operations in Python Strings have negative indexing as well as positive indexing.Positive indexing starts from the first character of the string value and the first index number is zero. We know this.In negative indexing, it starts from the last value and progresses to the beginning.Index numbers starts from -1 in negative indexing.We can index according to these index numbers :  Indexing using negative index nunber..
Indexing and Slicing in Strings in Python In Python, the process of accessing values, characters,  etc. in a data type is called indexing.Square brackets are used while indexing.And the index number of the value we want to reach is written in square brackets. For example, we want to reach teh first character of the value in the variable car below.Since insdex number starts from zero in Python, we wrote zero in square brackets. The proce..
Methods in String in Python-3 The title() method converts only the first letter of the words in a string expression to uppercase     The strip() method in used to trim the values we want from the beginning and end of string values.    If we don't write anything inside the method, by default it removes all spaces to the left and right.     The strip() method can take a value in it. Trims all of this value at the begining and ..
Methods in Strings in Python 2 Replace method is used to replace characters in string values.    It takes two values in it. The first is the value we want to change, and the other is new value.     For example, we wanted to get rid of the hypens between the letters of the name "joseph" below. And we did this request with the replace method.     In the Replace method, we can determine the number of changes we wnat to make on t..

반응형