Posts Tagged with
Python
If you want to shutdown your Windows PC from your Python code, just use this code snippet.
import os os.system("shutdown /s /t 1") That’s it. I hope this helps. Do you recommend reading this blog post? share it!
Python sys Variables variable meaning argv Command line args builtin_module_names Linked C modules byteorder Native byte order check_interval Signal check frequency exec_prefix Root directory executable Name of executable exitfunc Exit function name modules Loaded modules path Search path platform Current platform stdin, stdout, stderr File objects for I/O version_info Python version info winver Version number Python sys.
Because Python is sitting of the shoulders of giants. Built-in functions are written in C and C++ under the hood.
C and C++ languages are efficient and fast, so their functions will be faster than the functions you write in Python. So it is recommended to use built-in functions instead of creating new ones.