Python Session 19j Updated
Python Session 19j Updated
isdir() method
returns False if path is an
existing directory.
1. True
2. False
Just a Minute
isdir() method
returns False if path is an
existing directory.
1. True
2. False
Answer: False
File Names and Paths
(Contd.)
Example:-
File Names and Paths
(Contd.)
Example:-
File Names and Paths
(Contd.)
Example:-
Command Line
Arguments
import sys
print 'Count',len(sys.argv)
print ('Type',type(sys.argv))
for arg in sys.argv:
print('Argument',arg)
Execution :-
python argumente.py python course for beginners
Output :-
argumente.py
python
course
for
beginners
Just a Minute
Answer: Sys.argv
Pipes
Example:
Python can automate some of the tasks that commonly come across in
a daily routine.
A Python script can do a task which has to be done for hundreds of
files.
An operating System module provides the functions for working with
files and directories.
It is possible to pass some values from the command line to your
python programs when they are executed.
Parsing arguments is important for the program specially when there is
need to control from outside instead of hardcoding.
A pipe is an object that represents a running process.