Created
February 10, 2015 22:11
-
-
Save knotech/acea08600e34ba365e05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This file will be printit.py | |
#!/usr/bin/env/python3 | |
def printit(string): | |
print(string) | |
## This file will be in the same directory and called import_printit.py . | |
#!/usr/bin/env python3 | |
from printit import printit | |
if __name__ == '__main__': | |
string = input("String to print.") | |
printit(string) | |
## running the second file will import the function printit from the file printit.py | |
## the printit function will be available in the global name space of the program | |
## import_printit.py | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment