This is the post in which you will learn about the Files in Python. Basically you can, by using this post learn how to create a file, write data and read data from it !
Things this code will do:
- Create a Folder Test
- Changes the Current Working Directory
- Creates a file as per your given name
- Stores the Data you give as input
- Shows the Data you gave as input
# Create a Directory and make it as working dir.
print "current working Dir: ",os.getcwd()
name=raw_input("Give the Name: ")
# Open a file and writing into it
fo = open(name, "w+")
fo.write(raw_input("Give the Data : "))
# Open a file and reading it
fo = open(name, "r+")
str = fo.read();
print "Read The Data :",str
Got problems ?
Ask us anything anytime, we will help you soon !
Latest posts by Bikash Panda (see all)
- Firmata protocol with Raspberry Pi and Arduino - September 13, 2017
- IOT:Power outlet controlled from internet using WeMOS - August 9, 2017
- OSMC on Raspberry PI with Setup and Control using Android App - July 7, 2017