Lesson 30 of 34
Files: రాయడం మరియు చదవడం
9 min 30 XP
ప్రోగ్రామ్ ముగిసిన తర్వాత కూడా డేటా ఉండాలంటే దాన్ని file లో సేవ్ చేయండి. 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 మీ బ్రౌజర్లో మాత్రమే ఉంటాయి, refresh చేస్తే పోతాయి. మీ కంప్యూటర్లో Python ఇన్స్టాల్ చేస్తే నిజమైన files తయారవుతాయి.