# Open a file
fo = open(".txt", "rw+")
print "File name: ", fo.name
line = fo.readline()
print "Read data: %s" % (line)
# Get the current file position
pos = fo.tell()
print "Current position: %d" % (pos)
# Close the file
fo.close()
The output of the above example is:
File name: .txt
Read data: 1:www.
Current position: 17