[Question] What happens when I use% in python?

I often see% used in python's return and print statements. However, there is nothing that comes to my mind even if I check the usage of % on the net.

For example, the code below is a partial excerpt of the code that creates the bipartite graph, but % is used in the return statement.

class Vertex(object):
    """A Vertex is a node in  a graph"""
    def __init__(self, label = ''):
        self.label = label
    def __repr__(self):
        return 'Vertex(%s)' % repr(self.label)
    __str__ = __repr__

Question

  1. What does this % mean?
  2. At the same time, I don't really understand the meaning of __str__ = __repr__, so I would like to hear from you.

Recommended Posts

[Question] What happens when I use% in python?
What I learned in Python
What I do when imitating embedded go in python
Use config.ini in Python
Use dates in Python
When I try matplotlib in Python, it says'cairo.Context'
Use Valgrind in Python
Use profiler in Python
What I did when updating from Python 2.6 to 2.7
After all, what should I use to do type comparisons in Python?
Use pydantic when reading environment variables in Python
[Beginner] What happens if I write a program that runs in php in Python?
What I did when I got stuck in the time limit with lambda python
Use communicate () when receiving output in a Python subprocess
I tried to summarize how to use pandas in python
I want to use the R dataset in python
What I was addicted to when using Python tornado
I want to do something in Python when I finish
Let's use def in python
Use let expression in Python
Use Measurement Protocol in Python
Use callback function in Python
Use parameter store in Python
Use HTTP cache in Python
Use MongoDB ODM in Python
Use Random Forest in Python
Use regular expressions in Python
Use Spyder in Python IDE
Attention when os.mkdir in Python
I understand Python in Japanese!
A template that I often use when making Discord BOT in Python (memorial note)
What I got stuck around GUI in WSL python environment
Check in advance what happens when you execute the command
What I was addicted to when migrating Processing users to Python
What to do when "SSL: CERTIFICATE_VERIFY_FAILED _ssl.c: 1056" appears in Python
What I was asked when using Random Forest in practice
Precautions when using pit in Python
Use fabric as is in python (fabric3)
Behavior when listing in Python heapq
How to use SQLite in Python
Use rospy with virtualenv in Python3
I wrote Fizz Buzz in Python
How to use Mysql in python
Use Python in pyenv with NeoVim
I learned about processes in Python
I can't install scikit-learn in Python
How to use ChemSpider in Python
I wrote the queue in Python
Use OpenCV with Python 3 in Window
I tried Line notification in Python
Use gcc-4.2 when compiling Python (MacOS)
When using regular expressions in Python
When writing a program in Python
I wrote the stack in Python
I got an AttributeError when mocking the open method in python
What I was addicted to when introducing ALE to Vim for Python
[Python] When you want to use all variables in another file
Scribble what I used when using ipython in formatting pos data
I get a can't set attribute when using @property in python
What I did when I wanted to make Python faster -Numba edition-
Animate what happens in frequency space when the Nyquist frequency is exceeded