Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore ไพธอน

ไพธอน

Published by faridah30046, 2021-03-03 09:29:59

Description: ไพธอน

Search

Read the Text Version

Part IV – Input/Output Files การอา่ นและเขียนไฟล์ #Example 1 file = open(\"d:/newfile.txt\", \"w\") # file.write(\"hello world in the new file\") file.write(\"and another line\") file.close() file = open(\"d:/newfile.txt\", \"r\") print(file.read()) file.close() file = open(\"d:/newfile.txt\", \"r\") print(file.read(5)) #using file.read(n), where \"n\" determines number of characters. file.close()

Part IV – Input/Output Files การอ่านและเขยี นไฟล์ #Example 1 file = open(\"d:/newfile.txt\", \"r\") print(file.readline()) file.close()''' file = open(\"d:/newfile.txt\", \"r\") for line in file: print(line)

อา้ งงอิง https://www.google.com/search?q=python&oq=python&aqs=chrome ..


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook