Output formatted output in Python, such as C / C ++ printf.

Tatoheba

print "year:%d, month:%d, day:%d" % (year, month, day)

That is, the operator'%' is the heart of it. The operator'%' means modulo operation in the value, but overloads it as a format in the Unicode string. In "format% values", the% conversion specification in format is replaced by 0 or more elements in values.

By the way, in C ++ boost :: format ()

std::out << boost::format("year:%d, month:%d, day:%d") % year % month % day;

Recommended Posts

Output formatted output in Python, such as C / C ++ printf.
Next Python in C
Japanese output in Python
How to output "Ketsumaimo" as standard output in Python
C API in Python 3
Binary search in Python / C ++
Read Fortran output in python
Sort and output the elements in the list as elements and multiples in Python.
Output 2017 Premium Friday list in Python
Use fabric as is in python (fabric3)
ABC166 in Python A ~ C problem
Make standard output non-blocking in Python
Solve ABC036 A ~ C in Python
How to wrap C in Python
Export and output files in Python
Solve ABC037 A ~ C in Python
Write C unit tests in Python
Solve ABC175 A, B, C in Python
Data input / output in Python (CSV, JSON)
Output tree structure of files in Python
Algorithm in Python (ABC 146 C Binary Search
Implement FIR filters in Python and C
In python + sqlite3 "OperationalError: no such column:"
Write O_SYNC file in C and Python
Modules of frequently used functions in Python (such as reading external files)
Generate C language from S-expressions in Python
What happens if you do "import A, B as C" in Python?
Run Python in C ++ on Visual Studio 2017
How to run GUI programs such as tkinter in Python environment on WSL2
How to use the C library in Python
Output the number of CPU cores in Python
Python C / C ++ Extension Pattern-Pass data to Python as np.array
3.14 π day, so try to output in Python
How to generate permutations in Python and C ++
Read JSON with Python and output as CSV
Run Python YOLOv3 in C ++ on Visual Studio 2017
Note on encoding when LANG = C in Python
Find prime numbers in Python as short as possible
Boost.NumPy Tutorial for Extending Python in C ++ (Practice)
Class inheritance practice in python as seen in sklearn
Call a Python script from Embedded Python in C ++ / C ++
Output in the form of a python array
I tried adding a Python3 module in C
Use python in Docker container as Pycharm interpreter
[python] [c ++] bisect (* _bound) in reverse (descending) list
Speed evaluation of CSV file output in Python
First deep learning in C #-Imitating implementation in Python-
Quadtree in Python --2
Python in optimization
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
SendKeys in Python
Meta-analysis in Python
Unittest in python
python learning output
Epoch in Python
Discord in Python
Sudoku in Python
DCI in Python