How will you concatenate multiple strings together in Python?

We can use following ways to concatenate multiple string together in Python:

  • use + operator:
    E.g.
    >>> fname=”John”
    >>> lname=”Ray”
    >>> print fname+lname
    JohnRay
  • use join function:
    E.g.
    >>> ”.join([‘John’,’Ray’])
    ‘JohnRay’
Read the full book at www.amazon.com
Posted in Python, Python Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

*