I have written a small python module called phpcs. I folder structure cs_qa_support phpcs init .py config_file.py setup.py
contents of setup.py
from setuptools import setup
setup(name='cs_qa_support',
version='0.1',
description='QA Support',
packages=['phpcs'],
zip_safe=False)
I installed this using the command
pip install -e .
the file phpcs/ init .py is empty the content of phpcs/confif_file is
class PhpcsConfigFile:
def __init__(self,configFileName):
self.__config_file_name = configFileName
def dump(self):
print self.__config_file_name
given all of that I want to start using the module
my first attempt
>>> import phpcs
>>> config_file.PhpcsConfigFile
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'config_file' is not defined
second attempt
>>> from phpcs import config_file
>>> config_file.PhpcsConfigFile
<class phpcs.config_file.PhpcsConfigFile at 0x7fe5ef4b7738>
My question is can I avoid typing config_file.PhpcsConfigFile and just use PhpcsConfigFile?
Thanks
您可以像这样从phpcs导入配置文件,做到这一点,然后再这样做con.phpcsConfifFile
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.