»Ë»Ñ Ä¿¹Â´ÏƼ
Áú¹®/¿äû ÀÔ´Ï´Ù.
  • ºÏ¸¶Å© ¾ÆÀÌÄÜ

ÆÄÀ̽ã Àß ÇϽô ºÐ Áú¹®Á» ¹Þ¾ÆÁÖ¼¼¿ä ¤Ð¤Ð5

ÀڷᱸÁ¶¸¦ ¹è¿ì´Â ÁßÀε¥ ÆÄÀ̽ãÀ¸·Î ÆÀÇÃÀ» ÇÏ´Ù°¡ ¹®Á¦°¡ »ý°å½À´Ï´Ù.

 

¿ø·¡´Â Ŭ·¡½º¸¦ ´Ù Á¤ÀÇÇØ µÎ°í 

±× Ŭ·¡½ºÀÇ À̸§À» ´Ù ¸®½ºÆ®¿¡ ÀúÀåÇØ µÎ·Á°í Çߴµ¥ ¾Æ¹«¸® ã¾ÆºÁµµ ³ª¿ÀÁö¸¦ ¾Ê³×¿ä ¤Ð¤Ð

 

¿¹¸¦ µé¾î

 

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)

0
ÃßõÇϱ⠴ٸ¥ÀÇ°ß 0
|
°øÀ¯¹öÆ°

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 ûÁÖ±Ýõµ¿

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 ¶óÀÓÈ«´Ü

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 ¿äü

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 ½Ã³×À¾À¾

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 nightwhite
  • ¾Ë¸² ÄÚ¸àÆ® µî·Ï ½Ã 2Á¡, ¼±ÅÃÇϱ⠽à 3Á¡ÀÌ ºÎ¿©µË´Ï´Ù.
©¹æ »çÁø  
¡â ÀÌÀü±Û¡ä ´ÙÀ½±Û ¸ñ·Ïº¸±â