DEV Community

Naveen Kannan
Naveen Kannan

Posted on

Python: print() methods

Hi all,
Today, I learned about the Python print statement. It is fascinating to know that Python has so much functionality.I will share some of the thing i learned today

  1. sep, the sep parameter is used with the print() function to specify the separator between multiple arguments when they are printed.
  2. escape sequence like \n (new line), \t(adds space), \b(removes previous character).
  3. concatenation which adds two different strings.
  4. concatenating str and int which combine string and integer by converting integer into string by typecasting.
  5. Raw string A raw string in Python is defined by prefixing the string literal with an 'r' or 'R'.Raw strings are often used when working with regular expressions or when dealing with paths in file systems to avoid unintended interpretation of escape sequences.
  6. Format the format() method is used to format strings by replacing placeholders {} in the string with values passed as arguments.
  7. string multiplication here you can multiply strings by using the *operator. This operation allows you to multiply string a specified number of times.

Top comments (0)