i
Python functionality and evolution
Installing Python (windows and Ubuntu)
IDLE (Integrated Development and Learning Environment)
Write the first python program and execute it
Keywords in Python
Identifiers in Python
Indentation in Python
Comments in Python
Multi-line Comments in Python
Getting user input
Python Function
Calling a function
Arguments in Function
Scope of Variables
Modules in Python
The PYTHON PATH-Variable
Python File Open
Python File Opening Modes
The file-Object-Attributes
Python File Close() Method
Python File Read/Write
Python File Position
Renaming and Deleting Files in Python
Python Directory Methods
File/Directory Methods
Exceptions in Python
The try-finally Clause
The argument of Exception
Raising Exceptions
Python Built-in Exceptions
Python OOPs Concepts
Python Classes/Objects
Creating Instance Objects
Accessing Attributes
Built-In Class Attributes
Garbage Collection
Python Inheritance
Overriding Methods
Method overriding
Data Hiding
Regular Expression
The match function
The search function
Match Object Methods & Description
Matching or Searching
Search or Replace
Regular Expression Modifiers / Option Flags
Grouping with Parentheses
Python Socket Programming
Python Socket Server
Python Socket Client
Send Data Between Clients
Python Socket or Server
Python Socket Clients
Points to ponder
Files are contained within various directories, Python has no problem handling these too and OS module got several methods that help create/remove/change directories.
The mkdir()-Method
It can use the mkdir() method of the os module to create directories in the current directory. You need to supply the argument to this method which contains the name of directory to be created.
Syntax >>os.mkdir("newdir")
Example
Below is the example:
The chdir()-Method
For this we use the chdir() method to change current directory. The chdir() method takes argument which is the name of the directory that you want to make the current directory.x
Syntax >>os.chdir("newdir")
Example
Below is the example to go into "/home/newdir" directory −
The getcwd()-Method
The getcwd() method displays current working directory.
Syntax >>>>os.getcwd()
Example
Below shows example:
rmdir()-Method
The rmdir()-method deletes the directory, which is passed as argument in method. Before removing directory, all the contents in it should be removed.
Syntax >>>>os.rmdir('dirname')
Example
Below is example how to remove "/tmp/test" directory.
Don't miss out!