Perl2Python: Get the current working path
Perl Cwd can be used to get pathname of current working directory. use Cwd; my $dir = getcwd; Python To get the current working directory use os.getcwd() The question asked for the directory of a given file, so the proper answer is: import os os.path.dirname(os.path.realpath(__file__))