The tell () method tells you the current position within the file, in other words, the next read and write occurs after so many bytes at the beginning of the file:
The Seek (offset [, from]) method changes the position of the current file. The offset variable represents the number of bytes to move. The from variable specifies the reference position at which to begin moving bytes.
ChDir () method
You can use the ChDir () method to change the current directory. The ChDir () method requires a parameter that you want to set as the directory name of the current directory.
Grammar:
Os.chdir ("Newdir")
Example:
The following example goes to the "/home/newdir" directory.
#!/usr/bin/python
Import OS
# Change the current directory to "/home/newdir"
Os.chdir ("/home/newdir")
GETCWD () Method:
The GETCWD () method displays the current working directory.
Grammar:
OS.GETCWD ()
Example:
The following example gives the current directory:
#!/usr/bin/python
Import OS
# give the current directory
OS.GETCWD ()
This article is from the DBA Sky blog, so be sure to keep this source http://9425473.blog.51cto.com/9415473/1693781
Python-related file methods