"Hors d ' oeuvres"
When it comes to Python's strip method, presumably anyone who touches Python knows it is primarily used to remove spaces. There are two ways to achieve this.
Method One: Using built-in functions
If name = = ' main ': str = '
This article mainly introduces the Python strip () function and the split () function of the details and examples of relevant information, the need for friends can refer to the following
A detailed and practical example of the Python strip ()
Python strip () function and split () function details and examples, pythonstrip
Details and examples of python strip () and split () Functions
The strip and split functions are unclear for a long time. In fact, strip means deletion, while split
Summary of common Python string operation functions [split (), join (), strip ()], pythonstrip
This example describes common Python string operation functions. We will share this with you for your reference. The details are as follows:
Str. split (''
In Python3: split
>>> Help (Each_line.split) Help on
built-in function split:
split (...) method of Builtins.str instances.split (Sep=none, maxsplit=-1)-> List of strings return
a list of the words in S, using Sep as the delimiter s Tring. If
First,strip function prototypedeclaration:S is a string,rm is a sequence of characters to be deletedS.strip (RM) Remove The characters from the beginning and end of the S string in the RM delete sequenceS.lstrip (rm) Delete The character in the S
Strip function prototypesdeclaration : S is a string, RM is a sequence of characters to be deletedS.strip (RM) Remove the characters from the beginning and end of the s string in the RM delete sequenceS.lstrip (RM) Delete the character in the S
The Python Strip () method removes the character specified by the string's Kinsoku (the default is a space).GrammarStrip () method syntax:Str. Strip([chars]); Parameters
Chars--Removes the character specified by the tail of the string.
==>the startTo tell the truth just at the beginning I to strip () and split () These two really do not understand, later on the Internet to check the information to understand.Maybe people think that these two are very good distinctions, but I was
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.