我如何正确使用函数调用。我要执行 2 个批处理 python 脚本。一个在输入,一个在输出
How do i use function call properly. I am gonna do 2 batch python script. The one is in input the other one is output
假设我有两批 python file.First,一个是 hello.py
。下一个是john.py
print('Hello world!')
print('What is your name?')
myName = input()
for Name in myName (1,10):
print('It is nice to meet you, ' + myName)
以及我想如何在 john.py
处执行函数调用 myname。我需要同时 运行 2 批 python 吗?我在 for Name in myName (1,10)
行也有点困惑。什么意思number.Please帮帮我
要从您需要导入的不同文件中调用函数。
例如
calculator.py
def greeting():
print('Hello world!')
print('What is your name?')
myName = input()
print('It is nice to meet you, ' + myName)
john.py
from calculator import greeting
greeting() # call imported function
至于循环语句是无效的。你确定它是正确的吗?
假设我有两批 python file.First,一个是 hello.py
。下一个是john.py
print('Hello world!')
print('What is your name?')
myName = input()
for Name in myName (1,10):
print('It is nice to meet you, ' + myName)
以及我想如何在 john.py
处执行函数调用 myname。我需要同时 运行 2 批 python 吗?我在 for Name in myName (1,10)
行也有点困惑。什么意思number.Please帮帮我
要从您需要导入的不同文件中调用函数。
例如
calculator.py
def greeting():
print('Hello world!')
print('What is your name?')
myName = input()
print('It is nice to meet you, ' + myName)
john.py
from calculator import greeting
greeting() # call imported function
至于循环语句是无效的。你确定它是正确的吗?