ÀڷᱸÁ¶¸¦ ¹è¿ì´Â ÁßÀε¥ ÆÄÀ̽ãÀ¸·Î ÆÀÇÃÀ» ÇÏ´Ù°¡ ¹®Á¦°¡ »ý°å½À´Ï´Ù.
¿ø·¡´Â Ŭ·¡½º¸¦ ´Ù Á¤ÀÇÇØ µÎ°í
±× Ŭ·¡½ºÀÇ À̸§À» ´Ù ¸®½ºÆ®¿¡ ÀúÀåÇØ µÎ·Á°í Çߴµ¥ ¾Æ¹«¸® ã¾ÆºÁµµ ³ª¿ÀÁö¸¦ ¾Ê³×¿ä ¤Ð¤Ð
¿¹¸¦ µé¾î
Class apple:
a=0
b=0
c=0
Class phone:
a=0
b=0
c=0
Class ...
ÀÌ·±½ÄÀ¸·Î »çÀü¿¡ Ŭ·¡½º¸¦ ´Ù Á¤ÀÇÇصΰí
ÀÚµ¿À¸·Î (apple, phone, ...)ÀÌ·±½ÄÀ¸·Î ¸®½ºÆ®¿¡ Ŭ·¡½º À̸§¸¸ ´Ù ´ÙÀ½À¸·Á°í Çߴµ¥ ¾È µÇ³×¿ä ¤Ð¤Ð
Áö±Ý ½ÃµµÇغ» ¹æ¹ýÀº
for name, obj in inspect.getmembers(sys.modules[__name__]):
if inspect.isclass(obj):
ALL.append(obj)
ÀÌ·¸°Ô inspect ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ class ¿ÀºêÁ§Æ®¸¦ ã´Â ¹æ¹ýÀε¥,
[<class '__main__.DISON_1'>, <class '__main__.LG_1'>, <class '__main__.SAMSUNG_1'>, <class '__main__.XIAOMI_1'>]
ÀÌ·±½ÄÀ¸·Î µé¾î°¡¼ »ç¿ëÇÒ ¼ö°¡ ¾ø³×¿ä ¤Ð¤Ð
±×¸®°í Àú°Ô ¹®ÀÚ¿·Î µé¾î°¡¸é ±×·¡µµ ´ÙÇàÀÏ ÅÙµ¥
type ÀÌ typeÇüÀ̶ó°í ¶°¼ ¾î¶»°Ô ÇÒ ¼ö°¡ ¾ø´Â »óȲÀÔ´Ï´Ù ¤Ð¤Ð¤Ð¤Ð ²ª²ª ¤Ì¤Ì¤Ð¤Ð¤Ð¤Ì¤Ð
* freeboard ¿¡¼ °Ô½Ã¹° À̵¿µÇ¾ú½À´Ï´Ù (2019-03-20 21:12 / no : 6354544) |
ÀúµÎ¿ä¤¾ ½ºÅ¸ ÆÄÀ̽ãÀÎÁÙ