โดย chatee supasand » 17/01/2020 3:51 pm
โค้ด
โค้ด: เลือกทั้งหมด
for i in Recent_topic_link: # ลูปการเก็บลิงค์และไตเเติ้ล
save_link2 = i.get_attribute('href')
ผลลัพธ์
โค้ด: เลือกทั้งหมด
http://viewtopic.php?f=2&t=12&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
http://viewtopic.php?f=2&t=16&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
http://viewtopic.php?f=2&t=15&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
http://viewtopic.php?f=2&t=9&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
http://viewtopic.php?f=2&t=13&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
โดยต้องการลูปค่า URL ไว้ในตัวแปร
เช่น a1 =
http://viewtopic.php?f=2&t=12&sid=d82fc ... d6e8f7bbe3
a2 =
http://viewtopic.php?f=2&t=16&sid=d82fc ... d6e8f7bbe3
a3 =
http://viewtopic.php?f=2&t=15&sid=d82fc ... d6e8f7bbe3
ไปเรื่อยๆ อะครับ ต้องทำยังไง
โค้ด
[code]
for i in Recent_topic_link: # ลูปการเก็บลิงค์และไตเเติ้ล
save_link2 = i.get_attribute('href')
[/code]
ผลลัพธ์
[code]
http://viewtopic.php?f=2&t=12&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
http://viewtopic.php?f=2&t=16&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
http://viewtopic.php?f=2&t=15&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
http://viewtopic.php?f=2&t=9&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
http://viewtopic.php?f=2&t=13&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
[/code]
โดยต้องการลูปค่า URL ไว้ในตัวแปร
เช่น a1 = http://viewtopic.php?f=2&t=12&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
a2 = http://viewtopic.php?f=2&t=16&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
a3 = http://viewtopic.php?f=2&t=15&sid=d82fcb9c665dbe98f2d7cbd6e8f7bbe3
ไปเรื่อยๆ อะครับ ต้องทำยังไง