¾È³çÇϼ¼¿ä ÆÄÀ̽ã Å©·Ñ¸µ °ü·Ã ¸·È÷´ÂºÎºÐÀÌ ÀÖ¾î¼ ¿©Â庾´Ï´Ù.
for tireinfo in carinfo.findAll('tbody'):
ÀÌ·±½ÄÀ¸·Î ÇØ¼ tbody°ªÀ» °¡Á® ¿À¸é ¹Ø¿¡ ³»¿ëÀ» ±Ü¾î ¿É´Ï´Ù.
<td class="data-rim">
<span data-rim="oeP4mtKGrvqZma--"></span> #°¡Á®¿Í¾ßÇÒ °ª oeP4mtKGrvqZma--
<span class="_tooltip" data-original-title="Show Full Information" data-placement="right" data-toggle="tooltip">
<i class="rim icon-ajax-link fa fa-lg fa-plus-square-o link-red"></i>
</span>
<span class="rear-rim-data">
<span class="wheel-divider">|</span>
<span class="rear-rim-data-full">
<span data-rim="ouP4mtKGrvqZma--"></span> #°¡Á®¿Í¾ßÇÒ °ª ouP4mtKGrvqZma--
</span>
</span>
</td>
¿©±â¼ ±¸ÇØ¾ß ÇÒ°ÍÀÌ data-rim <=°ªÀ» 2°³¸¦ °¡Á®¿Í¾ß Çϴµ¥..
¾î¶»°Ô ±¸ÇöÇØ¾ß ÇÏ´ÂÁö µµÀúÈ÷ ¸ð¸£°Ú½À´Ï´Ù.
for rimsize in tireinfo.find_all('td',{'class':'data-rim'}):
print(rimsize.span['data-rim'])
ÀÌ·±½ÄÀ¸·Î for ¹®À» µ¹·ÁºÃ´Âµ¥.. ù¹øÂ°°ª Çϳª¸¸ °¡Áö°í ¿À´õ±º¿ä.
![]() |
2019.04.10 14:23:05 |
ÆÄÀ̽ã Å©·Ñ¸µ µµ¿ÍÁÖ¼¼¿ë.. |
Àâ´ã | 2,553¸íÀÌ Àоú¾î¿ä.
|





5°³ÀÇ ´ñ±Û |
À¥ Å©·Ñ¸µÀº »çÀÌÆ® ÁÖ¼Ò¸¦ ³²°ÜÁÖ¼Å¾ß Á¤È®ÇÑ ´äº¯ÀÌ °¡´ÉÇÕ´Ï´Ù. | |
2019/04/10 14:53
|
¶óÀ̺귯¸® »ç¿ë¹ý ¼÷Áö°¡ ÇÊ¿äÇØº¸ÀÔ´Ï´Ù.
ÀÏ´Ü, css selector ·Î ÀÛ¾÷Çϼ¼¿ä. ±×·¡¾ßÁö ´Ù¸¥¾ð¾î·Î Æ÷ÆÃÇÒ¶§µµ ½¬¿öÁý´Ï´Ù. tbody td span[data-rim] ÀÌ·¸°Ô¸¸Çϸé data-rim attribute°¡ Á¸ÀçÇÏ´Â dom °´Ã¼ °¡Á®¿É´Ï´Ù. Á¤¸®ÇÏÀÚ¸é, css selector ¸¦ Áö¿øÇÏ´Â find ÇÔ¼ö¸¦ »ç¿ëÇϽðí Á¦°¡ ÀûÀº selector ¾²½Ã¸é µË´Ï´Ù. |
|
2019/04/10 15:01
|
´äº¯°¨»çÇÕ´Ï´Ù.
¸·ÄÚµùÀ» ÇÏ´Ùº¸´Ï ±âÃÊ Áö½Äµµ ¾ø°í.. Áú¹®µµ ¾î·Æ°Ô ¸»¾¸µå·È³×¿ä. for n in rimsize.find_all('span',{'data-rim':True}): ÀÌ·¸°ÔÇØ¼ data-rimÀÇ °ªÀ» »Ì¾Æ ¿Ã¼ö ÀÖ¾ú½À´Ï´Ù. |
|
2019/04/10 15:11
|
¤»¤» ±»±»¿ä ![]() |
|
2019/04/10 15:16
|