Perl2Python: Get the current working path



Perl
Cwd can be used to get pathname of current working directory.
  1. use Cwd;
  2. my $dir = getcwd;

To get the current working directory use os.getcwd()
The question asked for the directory of a given file, so the proper answer is:
  1. import os
  2. os.path.dirname(os.path.realpath(__file__))

Comments

Popular posts from this blog

gspread error:gspread.exceptions.SpreadsheetNotFound

Miniconda installation problem: concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

转载:彻底搞清楚promoter, exon, intron, and UTR