Python မှာ ဖိုင်တွေကို ဖတ်ခြင်း၊ ရေးခြင်း ပြုလုပ်နိုင်ပါတယ်။ open() function ကိုသုံးပါတယ်။ with statement ကို သုံးတာက ဖိုင်ကို အလိုအလျောက် ပိတ်ပေးတဲ့အတွက် အကောင်းဆုံးဖြစ်ပါတယ်။
• "r": Read
• "w": Write
• "a": Append
python
with open("myfile.txt", "w") as f:
f.write("Hello, this is a new file.\n")
f.write("This is the second line.")
print("File 'myfile.txt' has been created.")You should see
File 'myfile.txt' has been created.