can i integrate a Python module into my own python code? -
i in process of writing quiz using simple python part of project- create executable file runs quiz when opened (so user doesn't have manually run code , potentially see answers of questions).
as part of quiz, use webbrowser module send user wikipedia page if first answer submitted incorrect can research correct one. there way integrate module code, doesn't need imported (and therefore if used on computer, user doesn't have download module in order take quiz).
seems beginner python . let me tell basic , first of whatever .py file create module in , lets have created file name example.py , can call module in file using:
import example
note: .py not required once imported correctly,you can call methods written in like:
example.func()
now, if have multiple modules, can keep inside folder(lets package
) ,so have:
package- a.py b.py c.py __init__.py
then have have file named init.py in same folder containing :
import import b import c
for more information read
for problem when compile whole project , modules generate .pyc file not in human readable form, not @ problem case mentioned user can read answeres .
Comments
Post a Comment