Detect enter key pressed python

Solution 1:

You can use keyboard lib.

pip3 install keyboard

import keyboard

if keyboard.read_key() == "enter":
    ...

https://github.com/boppreh/keyboard