Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python
Python
  1. ใช้ Boto3 ดึงรายการ Crawlers ทั้งหมดใน AWS Account

    ภาพรวมสาธิตการดึงรายชื่อ crawler ทั้งหมดใน AWS Glue Data Catalog โดยใช้ list_crawlersตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def list_crawlers(): session = boto3.session.Session() glue_client = session.client(glue) try: response = glue_client.list_cr

  2. ใช้ Boto3 ดึงรายการ Registries ทั้งหมดใน AWS Account

    ภาพรวมสาธิตการดึงรายการ registry ทั้งหมดใน AWS Glue Schema Registry โดยใช้ list_registriesตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def list_registries(): session = boto3.session.Session() glue_client = session.client(glue) try: response = glue_client.

  3. ใช้ Boto3 ดึงรายการ Schemas ทั้งหมดใน AWS Account

    ภาพรวมสาธิตการดึงรายการ schema ทั้งหมดใน AWS Glue Schema Registry โดยใช้ list_schemasตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def list_schemas(): session = boto3.session.Session() glue_client = session.client(glue) try: response = glue_client.list_sch

  4. ใช้ Boto3 ดึงรายการ Triggers ทั้งหมดใน AWS Account

    ภาพรวมสาธิตการดึงรายชื่อ trigger ทั้งหมดใน AWS Glue Data Catalog โดยใช้ list_triggersตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def list_triggers(): session = boto3.session.Session() glue_client = session.client(glue) try: response = glue_client.list_tr

  5. โปรแกรม Python นับ Leaf Node ใน Tree

    ภาพรวมนับจำนวน leaf node (โหนดที่ไม่มีลูก) ใน general tree โดยใช้ helper function แบบ recursionตัวอย่างโค้ดclass TreeNode: def __init__(self, data=None): self.key = data self.children = [] def add_child(self, node): self.children.append(node) def find_no

  6. โปรแกรม Python หาผลรวมของทุกโหนดใน Tree

    ภาพรวมสร้างโครงสร้างต้นไม้ (Tree) แบบ general tree และคำนวณผลรวมของทุกโหนด โดยใช้ recursionตัวอย่างโค้ดclass TreeNode: def __init__(self, data=None): self.key = data self.children = [] def set_root(self, data): self.key = data def add_child(self, node):

  7. โปรแกรม Python นับคู่ Tuple แบบ Bidirectional

    ภาพรวมนับจำนวนคู่ tuple ที่เป็น bidirectional pairs เช่น (45, 67) และ (67, 45) ถือเป็นคู่เดียวกันตัวอย่างโค้ดmy_list = [(45, 67), (11, 23), (67, 45), (23, 11), (0, 9), (67, 45)] print(รายการ:, my_list) count = 0 for i in range(len(my_list)): for j in range(i + 1, len(my_list)): # ตรวจสอ

  8. โปรแกรม Python นับ Unique Keys สำหรับ Value ใน Tuple List

    ภาพรวมนับจำนวนครั้งที่ tuple ปรากฏใน list ของ list โดยใช้ collections.defaultdictตัวอย่างโค้ดimport collections my_list = [[(Hello, Hey)], [(Jane, Will)], [(William, John)], [(Hello, Hey)], [(z, q)]] print(รายการต้นฉบับ:) print(my_list) my_result = collections.defaultdict(int) for elem in my_list:

  9. ใช้ Boto3 ดึงรายการ Workflows ทั้งหมดใน AWS Account

    ภาพรวมสาธิตการดึงรายชื่อ workflow ทั้งหมดใน AWS Glue Data Catalog โดยใช้ list_workflowsตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def list_workflows(): session = boto3.session.Session() glue_client = session.client(glue) try: response = glue_client.list

  10. ใช้ Boto3 รีเซ็ต Bookmark ของ Job ใน AWS Glue

    ภาพรวมสาธิตการรีเซ็ต job bookmark ใน AWS Glue โดยใช้ reset_job_bookmark ทำให้ job ประมวลผลข้อมูลใหม่ทั้งหมดตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def reset_job_bookmark(job_name): session = boto3.session.Session() glue_client = session.client(glue) try:

  11. ใช้ Boto3 เริ่ม Crawler ใน AWS Glue Data Catalog

    ภาพรวมสาธิตการเริ่ม crawler ทันทีโดยใช้ start_crawler ไม่สนใจตารางเวลาตัวอย่างโค้ด จะได้ CrawlerRunningExceptionผลลัพธ์# ครั้งแรก {ResponseMetadata: {RequestId: ..., HTTPStatusCode: 200, ...}} # ครั้งที่สอง (ขณะรันอยู่) Exception: boto3 client error: CrawlerRunningException: Crawler with name Data

  12. ใช้ Boto3 หยุด Scheduler ของ Crawler ใน AWS Glue Data Catalog

    ภาพรวมสาธิตการปิด scheduler ของ crawler โดยใช้ stop_crawler_schedule ทำให้ crawler ไม่อัตโนมัติรันตามตารางเวลาตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def stop_crawler_scheduler(crawler_name): session = boto3.session.Session() glue_client = session.client(glue)

  13. ใช้ Boto3 เริ่ม Scheduler ของ Crawler ใน AWS Glue Data Catalog

    ภาพรวมสาธิตการเปิดใช้งาน scheduler ของ crawler โดยใช้ start_crawler_schedule ทำให้ crawler รันตามตารางเวลาที่ตั้งไว้ตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def start_crawler_scheduler(crawler_name): session = boto3.session.Session() glue_client = session.client(

  14. ใช้ Boto3 เริ่ม Trigger ใน AWS Glue Data Catalog

    ภาพรวมสาธิตการเริ่ม trigger ใน AWS Glue โดยใช้ start_trigger ของ boto3 ทำให้ trigger ทำงานทันที ไม่สนใจ scheduleตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def start_trigger(trigger_name): session = boto3.session.Session() glue_client = session.client(glue) try:

  15. ใช้ Boto3 หยุด Trigger ใน AWS Glue Data Catalog

    ภาพรวมสาธิตการหยุด trigger ใน AWS Glue โดยใช้ stop_trigger ของ boto3ตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def stop_trigger(trigger_name): session = boto3.session.Session() glue_client = session.client(glue) try: response = glue_client.stop_trigger(

  16. ใช้ Boto3 เริ่ม Workflow ใน AWS Glue Data Catalog

    ภาพรวมสาธิตการเริ่ม workflow run ใหม่ใน AWS Glue โดยใช้ start_workflow_run ของ boto3ตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def start_workflow(workflow_name): session = boto3.session.Session() glue_client = session.client(glue) try: response = glue_c

  17. ใช้ Boto3 หยุด Workflow ใน AWS Glue Data Catalog

    ภาพรวมสาธิตการหยุด workflow run ที่กำลังดำเนินการอยู่โดยใช้ stop_workflow_run ต้องระบุ workflow name และ run IDตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def stop_workflow(workflow_name, run_id): session = boto3.session.Session() glue_client = session.client(glue)

  18. ใช้ Boto3 หยุด Crawler ใน AWS Glue Data Catalog

    ภาพรวมสาธิตการหยุด crawler ที่กำลังทำงานอยู่ใน AWS Glue โดยใช้ stop_crawler ของ boto3ตัวอย่างโค้ดimport boto3 from botocore.exceptions import ClientError def stop_crawler(crawler_name): session = boto3.session.Session() glue_client = session.client(glue) try: response = glue_cli

  19. โปรแกรม Python แสดงลำดับฟีโบนัชชีด้วย Recursion

    ภาพรวมสร้างลำดับฟีโบนัชชี (Fibonacci sequence) โดยใช้ฟังก์ชันเรียกซ้ำ (recursion)ตัวอย่างโค้ดdef fibonacci_recursion(n): ส่งคืนเลขฟีโบนัชชีตัวที่ n if n <= 1: return n else: return fibonacci_recursion(n-1) + fibonacci_recursion(n-2) num_terms = 12 if num_terms <= 0:

Total 9001 -คอมพิวเตอร์  FirstPage PreviousPage NextPage LastPage CurrentPage:262/451  20-คอมพิวเตอร์/Page Goto:1 256 257 258 259 260 261 262 263 264 265 266 267 268