How do I use 'ex25 import *'?

I tried entering ex 25 import * in the python interpreter in every way that I could but it dosen’t do anything good(Either idk how to enter it, or is meant to be like that.)

Can I get the syntax or a picture of the console so that it helps?

Hello @Dynamo_Nishant

You need to start the import with ”from”.

Then it looks like two different files you want to import (”ex” and ”25”).
You can only do one import at the time.
But I guess your are the same file (

It should something like this:

from ex_25 import *

Hi, everyone! I did two variants of import and from ex25 import * does not works at all. I have Windows 10. I do not know where the problem is. So, it is weird. I just use import ex25.

>>> from ex25 import *
>>> help(ex25)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'ex25' is not defined
>>> import ex25
>>> help(ex25)
Help on module ex25:


        This function will break up words for us.

        Prints the first and last words of the sentence.

        Sorts the words then prints the first and last one.

        Prints the first word after popping it off.

        Prints the last word after popping it off.

        Takes in a full sentence and returns the sorted words.

        Sorts the words.




Try if it helps to create in the same folder as, an empty file called:

This help Python to find files.

Otherwise you have to set the PYTHONPATH.
But I dont know how to do this on Windows.
Perhaps someone else can help with that part.

I found this tonight in exercise 52 in the book (LPTHW):

On Windows PowerShell do:
$env : PYTHONPATH = ”$env : PYTHONPATH ; . ”

I hope that is useful.

Actually @JohnP, it did work, just maybe not as you expected. You see the help(ex25) printed out help the 2nd time? Notice how it listed all the functions in your file?

The first time it imported you did this:

from ex25 import *

That’s telling python “Load the code, and then pull out all the functions and put them right here.” That means you can just type break_words instead of ex25.break_words.

Try both of those to see what I mean.

1 Like

Thank you. Now I see.

1 Like