🐍
Python For Starters
  • Overview
  • Python for starters
  • Content
  • Foreword
  • Introduction To Python
    • Python Installation
    • Variables
    • Python Data Types
    • Python Data Structures
    • Python numbers
    • Python strings
    • Python Boolean
    • Python constants
    • Python Comments
    • Type Conversion
    • Control flow in python
  • Python Functions
    • Function Definition
    • Function Parameter
    • Recursive Functions
    • Using Global Variables in Functions
    • Lambda Functions
  • What are Data Structures
    • Python Lists
    • Python Tuples
    • Python Dictionaries
    • Python Sets
    • Iterable in python
    • Python Map, Filter & Reduce Functions
  • Error handling in Python
  • Loop ... Else Clause, Partial Functions & Type Hints
    • Partial Functions
    • Type Hints
  • Python Modules
  • Python Libraries & Packages
    • Python Packages
  • Directory & IO
    • Python IO Module
  • Pyenv
  • Virtual Environments
    • Pipenv
    • Virtualenv
  • Object Oriented Programming in Python
    • Class
    • Class Methods
    • Python Class Inheritance
    • Python Class Polymorphism
    • Python special methods
  • Appendix
  • Contributing
Powered by GitBook
On this page
  1. Introduction To Python

Python strings

String

A string is a collection of characters wrapped in a single or double quote. Like many other popular programming languages, strings in Python are arrays of bytes representing Unicode characters.

first_name = "John"
last_name = "Doe"

# String formating patterns (Different ways to format your python strings)
full_name1 = first_name + " " + last_name
full_name2 = f'{first_name} {last_name}'
full_name3 = '{} {}'.format(first_name, last_name)

print(full_name1) # print the value of full_name1
print(full_name2) # print the value of full_name2
print(full_name3) # print the value of full_name3

PreviousPython numbersNextPython Boolean

Last updated 1 year ago