String Formatting

  • + 0 comments

    str.format() is one of the string formatting methods in Python3, which allows multiple substitutions and value formatting. This method lets us concatenate elements within a string through positional formatting.\ Ex:: print ("{}, A computer science portal for geeks." .format("GeeksforGeeks"))

    str = "This article is written in {}" print (str.format("Python"))

    print ("Hello, I am {} years old !".format(18))