3

Python Substrings: Everything You Need to Know

 2 years ago
source link: https://hackernoon.com/python-substrings-everything-you-need-to-know-031537pa
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Python Substrings: Everything You Need to Know

In python, a String is a sequence of characters that may contain special characters or alphanumeric characters, for example, "we meet on Friday at 08:00 am". It is possible to access sub-parts of the string commonly known as a python substring.

0 reactions

You can also define substring as a sequence of characters within a string. From the previous example, python substrings can be "Friday", "at", "meet", and others.

0 reactions

Python provides different ways and methods to generate a substring, check if a substring is present, index of a substring, and more.

0 reactions

You can extract a substring from a string by slicing with indices that obtain your substring as follows:

0 reactions

string[start:stop:step]

0 reactions
start - The starting index of the substring.stop - The ending index of a substring.step - A number specifying the step of the slicing. The default value is 1.

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK