Python indentation and string format

Python indentation and string format

Indent

You can indent from 1 to any number, and if you do it with different numbers, you will get an error. Indent = space

String format

With these, the character string and the character string can be combined.

print("xxx{}xxx".format(a))
print("xxx{1}xx{0}x".format(a,b))
print("xxx%sxx%sx"%(a,b))
print(f"xxx{b}xx{a}x")

Recommended Posts

Python indentation and string format
Python string format
Python string format
[Python 2/3] Parse the format string
String format with Python% operator
String format
String format 2
Python string
python string processing map and lambda
Python: String concatenation
python string slice
Python2 string type
Python # string type
format in python
Python string inversion
[Short sentence] [Python] Format and print lists and dictionaries
String to Unicode Escape Sequence Format for Python
Python and numpy tips
[Python] pip and wheel
python variable expansion, format
Batch design and python
String manipulation in python
Python iterators and generators
Python packages and modules
Vue-Cli and Python integration
[Python] Multi-line string assignment
Python string manipulation master
Ruby, Python and map
Hexadecimal string and string conversion
Image format in Python
python input and output
Python and Ruby split
[Python2] Date string-> UnixTime-> Date string
Python Pickle format notes
[Python] format methodical use
Random string generation (Python)
Python3> documentation string / docstring
Python3, venv and Ansible
Python asyncio and ContextVar
Python string processing illustration
Read and analyze arff format dataset with python scipy.io
Read json file with Python, format it, and output json
python> datetime> From date string (ISO format: 2015-12-09 12:40:08) to datetime type
[Python3] Format the character string using the variable name as the key.
Programming with Python and Tkinter
Encryption and decryption with Python
Python: Class and instance variables
[python] Convert date to string
3-3, Python strings and character codes
Python 2 series and 3 series (Anaconda edition)
Python and hardware-Using RS232C with Python-
Python on Ruby and angry Ruby on Python
Python real division (/) and integer division (//)
Install Python and Flask (Windows 10)
Remove double-byte spaces before and after the character string (python)
About python objects and classes
String object methods in Python
About Python variables and objects
[Python] Use a string sequence
Apache mod_auth_tkt and Python AuthTkt
Å (Ongustromu) and NFC @ Python