InfoHeap
Tech tutorials, tips, tools and more
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Python

    Python strings

    • Python string quick start tutorial
    • Python string split examples
    • Python string lowercase and uppercase
    • Python string contains check
    • int to string
    • string to int

    Python List (Array)

    • list basics
    • list append, prepend
    • list remove an item
    • merge lists
    • slice of list
    • array clone
    • initialize list with same value
    • value in list check

    Python Dictionary

    • dictionary basics
    • Python iterate dictionary
    • dictionary get key with default
    • sort dictionary by values

    Python control flow

    • if-elif-else
    • for loop

    Python Regex

    • re search() vs match()
    • re.match()
    • re.search()
    • re.sub()

    Python Cookbook

    • Command line - run python webserver
    • How to find python package's file location
    • Python etl petl - read table from csv file
    • Python file read write examples

    Python built-in functions

    • filter
    • filter vs ifilter
    • itertools ifilter
    • itertools imap
    • len
    • map
    • print
    • range
    • rstrip
    • type
    • xrange
     
    • Home
    • > Tutorials
    • > Python

    How to find python package’s file location

    By admin on Dec 7, 2015

    Here is simple python code snippet to see the file location of a python package on command line:

    $ python -c "import urllib2; print urllib2.__file__;"
    /usr/lib/python2.7/urllib2.pyc
    

    .pyc extension represent the compiled python code. To see source file, replace .pyc with .py. So in above case /usr/lib/python2.7/urllib2.py is the main file.

    Suggested posts:

    1. Command line – run python webserver
    2. Bash – how to get main program and current file dir location
    3. Python file read write examples
    4. How to open vim at previous location
    5. node – how to find source file location of a module
    6. Python re (regex) replace examples
    7. Python/Perl/Unix one liners
    8. Python selenium webdriver – quick start guide on Mac
    Share this article: share on facebook share on linkedin tweet this submit to reddit
    Posted in Tutorials | Tagged Linux, Linux/Unix Command Line, Mac, Python, Python cookbook, Tutorials, Ubuntu Linux

    Follow InfoHeap

    facebook
    twitter
    googleplus
    • Browse site
    • Article Topics
    • Article archives
    • Recent Articles
    • Contact Us
    • Omoney
    Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries

    Copyright © 2023 InfoHeap.

    Powered by WordPress