[Python] How to invert a character string

Sample code

#The string you want to invert
str = '12345'

#String[::-1]Can be reversed
rslt = str[::-1]
print(rslt)
# => '54321'

reference

-String inversion in Python -Notes from non-programmers

Recommended Posts

[Python] How to invert a character string
[Python] How to expand variables in a character string
Python learning basics ~ How to output (display) a character string? ~
How to embed a variable in a python string
[Introduction to Python] How to split a character string with the split function
[Introduction to Python] How to output a character string in a Print statement
[Introduction to Python] How to write a character string with the format function
How to convert / restore a string with [] in python
[Python] How to make a list of character strings character by character
[Python] How to convert a 2D list to a 1D list
# 5 [python3] Extract characters from a character string
How to get a stacktrace in python
How to run a Maya Python script
How to make a string into an array or an array into a string in Python
Try to extract a character string from an image with Python3
How to get a string from a command line argument in python
How to extract the desired character string from a line 4 commands
How to install Python
How to install python
How to quickly count the frequency of appearance of characters from a character string in Python?
How to read a CSV file with Python 2/3
How to create a Python virtual environment (venv)
How to open a web browser from python
How to clear tuples in a list (Python)
How to create a function object from a string
How to create a JSON file in Python
How to generate a Python object from JSON
How to add a Python module search path
Python Note: When assigning a value to a string
How to notify a Discord channel in Python
I tried to generate a random character string
[Python] How to draw a histogram in Matplotlib
[Python] How to change character string (str) data to date (strptime of datetime)
How to write a string when there are multiple lines in python
[2020.8 latest] How to install Python
Parse a JSON string written to a file in Python
I want to embed a variable in a Python string
[python] Convert date to string
How to install Python [Windows]
[Python] How to draw a line graph with Matplotlib
How to set up a Python environment using pyenv
A road to intermediate Python
How to write string concatenation in multiple lines in Python
[Python] Use a string sequence
[Python] How to use list 1
How to call a function
How to write a list / dictionary type of Python3
How to use Python argparse
How to build a Django (python) environment on docker
How to hack a terminal
Python: How to use pydub
How to make a Python package using VS Code
I want to split a character string with hiragana
[Python] How to write a docstring that conforms to PEP8
[Python] How to use checkio
How to run Notepad ++ Python
[Tentative] How to convert a character string to Shift_jis with kivy-ios Memo kivy v1.8.0
How to save a table scraped by python to csv
How to change Python version
[Python] How to create a 2D histogram with Matplotlib
How to develop in Python