Lesson 30 of 34
Files: എഴുതലും വായനയും
9 min 30 XP
പ്രോഗ്രാം അവസാനിച്ച ശേഷവും data സൂക്ഷിക്കാൻ അത് file-ൽ save ചെയ്യൂ. open(name, "w") എഴുതുന്നു, "a" കൂട്ടിച്ചേർക്കുന്നു, "r" വായിക്കുന്നു. with ഉപയോഗിച്ചാൽ file സ്വയം അടയും.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.ഒരു file വരി വരിയായി വായിക്കാൻ അതിൽ loop ചെയ്യൂ. strip() ഓരോ വരിയുടെയും അവസാനത്തെ \n നീക്കുന്നു.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.ഇവിടെ files നിങ്ങളുടെ browser-ൽ മാത്രമാണ്, refresh ചെയ്താൽ അപ്രത്യക്ഷമാകും. കമ്പ്യൂട്ടറിൽ Python install ചെയ്താൽ യഥാർത്ഥ files ഉണ്ടാകും.