Home | | Computer Science 12th Std | String Formatting Operators

Python - String Formatting Operators | 12th Computer Science : Chapter 8 : Core Python : Strings and String Manipulation

Chapter: 12th Computer Science : Chapter 8 : Core Python : Strings and String Manipulation

String Formatting Operators

The string formatting operator is one of the most exciting feature of python.

String Formatting Operators

The string formatting operator is one of the most exciting feature of python. The formatting operator % is used to construct strings, replacing parts of the strings with the data stored in variables.nhy re teolW

Syntax:

(“String to be display with %val1 and %val2” %(val1, val2))

Example

name = "Rajarajan"

mark = 98

print ("Name: %s and Marks: %d" %(name,mark))

Output

Name: Rajarajan and Marks: 98

 

Tags : Python , 12th Computer Science : Chapter 8 : Core Python : Strings and String Manipulation
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
12th Computer Science : Chapter 8 : Core Python : Strings and String Manipulation : String Formatting Operators | Python


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.