
May 16th, 2012, 05:52 PM
|
 |
JavaScript is not spelt java
|
|
Join Date: Feb 2011
Location: Landan, England
|
|
|
Extract from and import
Hello. From a Python file I want to extract the imported library names. For example:
Code:
import sublime, sublime_plugin as sp
from os import path as eric
import os, datetime, tempfile, desktop # some comment
I want to collect sublime, sublime_plugin etc.. I might also want to collect the (as) aliases, but initially I'm just interested in the library names.
I can assume that from or import are at the beginning of the lines, and they may be followed by eol, whitespace or # (indicating a comment).
This may be straight-forward 
|