Python Strip () method

Source: Internet
Author: User

Description

The Python Strip () method removes the character specified by the string's Kinsoku (the default is a space).

Grammar

Strip () method syntax:

Str.strip ([chars]);

Parameters

Chars--Removes the character specified by the tail of the string.

return value

Returns a new string that is generated by removing the string from the Kinsoku specified character.

Example

The following example shows how the strip () function is used:

# !/usr/bin/python  "0000000this is string EXAMPLE....WOW!!! 0000000"; Print ' 0 ' );

The result of the above example output is as follows:

this is string example....wow!!!

Removes only the characters specified by the beginning and ends of the string, and the middle part is not removed:

# !/usr/bin/python  "0000000this is string 0000EXAMPLE....WOW!!! 0000000"; Print ' 0 ' );

0 of the intermediate part of the output is still present:

this is string 0000example....wow!!!

Python Strip () method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.