For details about how to use the just ust () method in Python, pythonjust UST

Source: Internet
Author: User

For details about how to use the just ust () method in Python, pythonjust UST

Returns the right-side length and width of a string. Fill is done by using the specified fillchar (space by default ). If the width is less than len (s), the original string is returned.
Syntax

The syntax of the just ust () method is as follows:

Str. Fill ust (width [, fillchar])

Parameters

  • Width -- this is the total length after the string is filled.
  • Fillchar -- this is a fill character. The default value is space.

Return Value

This method returns the right-side length and width of a string. Fill is done by using the specified fillchar (space by default ). If the width is less than len (s), the original string is returned.
Example

The following example shows how to use the just ust () method.

#! /Usr/bin/pythonstr = "this is string example... wow !!! "; Print str. Must ust (50, '0 ');

When we run the above program, it will produce the following results:

000000000000000000 this is string example... wow !!! Str1 = "this is string example... wow !!! "; Str2 =" is "; print str1.rindex (str2); print str1.index (str2 );

When we run the above program, it will produce the following results:

52

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.