本文整理汇总了Python中mymodule.sayhi函数的典型用法代码示例。如果您正苦于以下问题:Python sayhi函数的具体用法?Python sayhi怎么用?Python sayhi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sayhi函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# Filename: mymodule_demo.py
import mymodule
mymodule.sayhi()
print 'Version', mymodule.version
示例2: sayhi
#!/usr/bin/python
#使用自己的模块mymodule
#Filename: mymodule_demo2.py
from mymodule import sayhi, version;
#Alternative:
#from mymodule import *;
sayhi();
print("Version", version);
示例3: sayhi
#!/usr/bin/python
# Filename: mymodule_demo2.py
import mymodule
from mymodule import sayhi, version
# Alternative:
# from mymodule import *
sayhi()
print("Version", version)
示例4:
import mymodule
import RiskRuleTemplate
mymodule.sayhi();
print '哇哈哈'
示例5: sayhi
#!/usr/bin/python
import sys
#path='/xxx/xxx' # the mymodule.py should be in the directory
#sys.path.append(path)
from mymodule import sayhi, version
print "the command line arguments are:"
for i in sys.argv:
print i
if __name__ == '__main__':
print 'The import.py program is being run by itself'
else:
print 'The import.py program has been imported from another module'
sayhi() #call it directly
print "mymodule.version:", version
示例6: main
def main():
i = 5
print(i)
i = i + 1
print("value of i is", i)
############### Testing the method of application of string output
s = """This is a multi-line string.
This is the second line."""
print(s)
s = "This is a string. \
This continues the string."
print(s)
i = 10 ** 10
print("i = 10**10 = ", i)
i = 134
j = 50
k = i // j
print(" i =", i, " j =", j, " k = i//j =", k)
k = i % j
print(" i =", i, " j =", j, " k = i%j =", k)
############### Testing the method of application of for-loop
for i in (10, 12, 33, 14, 57):
if ~i % 2:
print(i, "is an even number.")
else:
print(i, "is an odd number.")
for i in range(0, 3):
print(i)
else:
print("The for loop is over with outputting range(0,3)")
for i in range(0, 300, 98):
print(i)
else:
print("The for loop is over with outputting range(0, 300, 98)")
## ############### Testing the method of application of while-if
## number = 23
## guess = 10
## while(guess!=number):
## guess = int(input('Enter an integer to guess: '))
## if guess == number:
## print('Congratulations, you guessed it.') # New block starts here
## print("(but you do not win any prizes!)") # New block ends here
## elif guess < number:
## print('No, it is a little lower than that') # Another block
## # You can do whatever you want in a block ...
## else:
## print('No, it is a little higher than that')
## # you must have guess > number to reach here
## else:
## print('The while loop is over.')
## # Do anything else you want to do here
## print('Done')
## ############### Testing the method of application of break-clause
## while True:
## s = input('Enter something until with quit: ')
## if s == 'quit':
## break
## elif len(s) < 3:
## print('input string is too short to quit')
## continue
## print('Length of the string is', len(s))
## print('Done')
############### Testing the method of application of call-funtion
sayHello()
printMax(100, 321)
print("maximum(123,142) is", maximum(123, 142))
printMaxDoc(123, 142)
print(printMaxDoc.__doc__)
help(printMaxDoc)
help(printMax)
############### Testing the method of application of modules
print("The command line arguments are:")
for i in sys.argv:
print(i)
print("\n\nThe PYTHONPATH is", sys.path, "\n")
mymodule.sayhi()
print("mymodule.version is", mymodule.version)
# Fcn001.main() # the same behavior with the time import first time
# print('Fcn001.version is',Fcn001.version)
print("math.sqrt(10.2) =", math.sqrt(10.2))
print()
print("multiply(10,21) is", mymodule.multiply(10, 21))
print("divide(10,21) is", mymodule.divide(10, 21))
print()
############### Testing the method of application of intrinsic constant
if __name__ == "__main__":
print("This program is being run by itself")
else:
print("I am being imported from another module")
# print(__path__)
# print(__line__)
print("current file path is", __file__)
############### Testing the method of application of dir() fcn.
zzz = 99
newInt = 100
print("Show the attribute-list of current module as following:")
print(dir())
yy = 78
#.........这里部分代码省略.........
示例7: sayhi
from mymodule import sayhi,__version__
#from mymodule import * #这里使用 * 不会导入__version__(可以理解为双下划线开头的变量是private的)
sayhi()# 如果指定了导入的function 那可以直接调用function 而不需要module 名
print('Version',__version__)
示例8:
#!/usr/bin/python
# Filename: mymodule_demo.py
import mymodule as md
import using_name
md.sayhi()
print('Version is ',md.version)
#dir(md)