2018年1月10日 星期三

Python: List the special variables used within the language

Python: List the special variables used within the language

Python Basic: Exercise-97 with Solution

Write a Python program to list the special variables used within the language.
Sample Solution:-
s_var_names = sorted((set(globals().keys()) | set(__builtins__.__dict__.keys())) - set('_ names i'.split()))
print()
print( '\n'.join(' '.join(s_var_names[i:i+8]) for i in range(0, len(s_var_names), 8)) )
print()

=========== RESTART: F:/Python_APSC/py-ex-basic-97.py =============

ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning
ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError DeprecationWarning EOFError Ellipsis
EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning GeneratorExit
IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError KeyError
KeyboardInterrupt LookupError MemoryError NameError None NotADirectoryError NotImplemented NotImplementedError
OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning
RuntimeError RuntimeWarning StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit
TabError TimeoutError True TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError
UnicodeTranslateError UnicodeWarning UserWarning ValueError Warning WindowsError ZeroDivisionError __build_class__
__builtins__ __debug__ __doc__ __file__ __import__ __loader__ __name__ __package__
__spec__ abs all any ascii bin bool bytearray
bytes callable chr classmethod compile complex copyright credits
delattr dict dir divmod enumerate eval exec exit
filter float format frozenset getattr globals hasattr hash
help hex id input int isinstance issubclass iter
len license list locals map max memoryview min
next object oct open ord pow print property
quit range repr reversed round set setattr slice
sorted staticmethod str sum super tuple type vars
zip

>>> 

沒有留言:

張貼留言

MQTT 協定與 Modbus 通訊的遠端監控與控制系統架構

MQTT 協定與 Modbus 通訊的遠端監控與控制系統架構 這張圖片展示了一個 結合 MQTT 協定與 Modbus 通訊的遠端監控與控制系統架構 (主要透過 Node-RED 進行資料整合)。 系統包含三個核心部分,其運作功能說明如下: 1. ESP32 終端設備(硬體控制層...