Skip to content

Instantly share code, notes, and snippets.

@Aetopia
Last active April 29, 2022 15:56
Show Gist options
  • Save Aetopia/98e398d52da38191ac346fe598df82dd to your computer and use it in GitHub Desktop.
Save Aetopia/98e398d52da38191ac346fe598df82dd to your computer and use it in GitHub Desktop.
Python Functions
# Clear all of the text within the terminal, Python is running in.
def clear():
"""
Clears the terminal.
"""
if system() == 'Windows':
clear = 'cls'
else:
clear = 'clear'
run(clear, shell = True)
# Vanilla pause function for Python!
from time import sleep
def pause(msg: str = 'Press Ctrl + C to continue...'):
"""
Suspends the executing script, to continue execution press Ctrl + C.
Default Message -> "Press Ctrl + C to continue..."
"""
if msg != None:
print(msg)
while True:
try:
sleep(1)
except KeyboardInterrupt:
break
print('Remote Script!')

This is a gist where you can find handy Python Functions for your projects!
Feel free to use them! ;D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment