1) What function is used to open a file in Python? a) open('fruit.txt', 'r+') b) open('fruit.txt', 'a+') c) open('frut.txt', 'a') d) none of the above 2) What is the best approach to guarantee that a file object is correctly closed after use whenever possible? a) Using close() at the end of the code b) Using try and finally blocks c) Using the with keyword d) None of the above 3) What function is used to get a list of all lines in a file? a) read() b) readlines() c) write() d) None of the above 4) Which of the following file types can be opened with notepad as well as ms excel? a) Binary Files b) Text Files c) CSV Files d) none of the above 5) . To open a file c:\scores.txt for writing, we use ____________ a) outfile = open(“c:\scores.txt”, “w”) b) outfile = open(“c:\\scores.txt”, “w”) c) outfile = open(file = “c:\scores.txt”, “w”) d) outfile = open(file = “c:\\scores.txt”, “w”)
0%
python panchayat
แชร์
แชร์
แชร์
โดย
Freeuse6669
แก้ไขเนื้อหา
สั่งพิมพ์
ฝัง
เพิ่มเติม
กำหนด
ลีดเดอร์บอร์ด
แสดงเพิ่มขึ้น
แสดงน้อยลง
ลีดเดอร์บอร์ดนี้ตอนนี้เป็นส่วนตัว คลิก
แชร์
เพื่อทำให้เป็นสาธารณะ
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานโดยเจ้าของทรัพยากร
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานเนื่องจากตัวเลือกของคุณแตกต่างสำหรับเจ้าของทรัพยากร
แปลงกลับตัวเลือก
แบบทดสอบ
เป็นแม่แบบแบบเปิดที่ไม่ได้สร้างคะแนนสำหรับลีดเดอร์บอร์ด
ต้องลงชื่อเข้าใช้
สไตล์ภาพ
แบบ อักษร
ต้องสมัครสมาชิก
ตัวเลือก
สลับแม่แบบ
แสดงทั้งหมด
รูปแบบเพิ่มเติมจะปรากฏเมื่อคุณเล่นกิจกรรม
เปิดผลลัพธ์
คัดลอกลิงค์
คิวอาร์โค้ด
ลบ
คืนค่าการบันทึกอัตโนมัติ:
ใช่ไหม