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

>>> 

沒有留言:

張貼留言

Node-Red --> MQTT --> Fuxa 開源碼網頁式圖控平台

Node-Red --> MQTT --> Fuxa      FUXA(一個開源的 Web HMI / SCADA 自動化監控軟體)的專案設定檔 。 這份設定檔完整定義了 HMI 監控畫面的 後端通訊(MQTT 連線、點位標籤) 與 前端網頁圖形介面(SVG 畫布...