Computer Science, asked by cpsingh6050, 10 months ago

Define string manipulation in python

Answers

Answered by Anonymous
1

\bold {ANSWER }

♦String manipulation (or string handling) is the process of changing, parsing, splicing, pasting, or analyzing strings.

♦String manipulation typically comes as a mechanism or a library feature of in most programming languages

Answered by fiercespartan
3

In simple terms, a string in python is anything that is either under the apostrophe(' ') or the quotations marks(" ").

This string can not be treated as a number, integer, float or Boolean.

Anything could be converted into a string by writing the command as:

str() And place anything inside of those brackets/parenthesis.

Now, I will be going over a few important string features.

Let's take a string. my_string = 'Hello there!'

Combining two string:

We simply use the symbol '+' to combine any number of strings.

Manipulating strings:

Let's say we have to change a few words in our string. What do we do? We first, take all the characters in a string and place them in a list.

In order to do that, we will say list(my_string). The output would look as follows:

['H','e','l','l','o',' ','t','h','e','r','e']

And now by manipulating this list, we can get our desired outcome.

Let's say we want to change the 'H' to 'L'. We simply say:

my_string[0] = 'L'

And then, if we want to print to word back again, we use this:

''.join(my_string) \

The output would be : Lello there!

If you want to see other list manipulations, I have answered a question earlier, please refer to that:

brainly.in/question/4046934

Hope it helps!

Similar questions