Just use the classic ==
operator:
>>> [0,1,2] == [0,1,2]
True
>>> [0,1,2] == [0,2,1]
False
>>> [0,1] == [0,1,2]
False
Lists are equal if elements at the same index are equal. Ordering is taken into account then.
More Related Contents:
- How to handle special cases in my Python code?
- In python, how do you locate a specific word in a string file. [closed]
- Why are global variables evil? [closed]
- How do I check if a variable exists?
- Good Python modules for fuzzy string comparison? [closed]
- Get HTML source of WebElement in Selenium WebDriver using Python
- How to get the input from the Tkinter Text Widget?
- Can I set max_retries for requests.request?
- Python mysqldb: Library not loaded: libmysqlclient.18.dylib
- Is python’s sorted() function guaranteed to be stable?
- What is the best (idiomatic) way to check the type of a Python variable? [duplicate]
- Adding a legend to PyPlot in Matplotlib in the simplest manner possible
- Display the output of the program on GUI with tkinter?
- Python (and Python C API): __new__ versus __init__
- How to use type hints in python 3.6?
- How to set xlim and ylim for a subplot in matplotlib [duplicate]
- Matplotlib scatter plot with legend
- How can I troubleshoot Python “Could not find platform independent libraries “
- Why does a space affect the identity comparison of equal strings? [duplicate]
- How to receive json data using HTTP POST request in Django 1.6?
- Extract Values between two strings in a text file using python
- eval SyntaxError: invalid syntax in python
- ImportError: No module named ‘selenium’
- Bitwise XOR of hexadecimal numbers
- Flask – POST Error 405 Method Not Allowed
- Math Expression Evaluation
- How can I prevent Google Colab from disconnecting?
- How to do multiprocessing in FastAPI
- “SSL certificate verify failed” using pip to install packages
- Why does tkinter (or turtle) seem to be missing or broken? Shouldn’t it be part of the standard library?