我是Visual Fox pro的新手,想知道如何将fox pro中的参数传递给我的python脚本文件。
这些是我在Fox Pro中的参数:
PARAMETERS curr_addr,curr_city,curr_state
现在我想将它们传递给我的python脚本文件
RUN py“ C:\ Users \ Documents \ Geocode.py” ---我运行脚本文件的位置
我的脚本文件里面是这个功能
g = geocoder.osm('cust_addr','cust_city','cust_state''cust_zip')
任何解决方案?
Python必须通过其解释器启动,例如python.exe。第一个参数python.exe就是.py脚本的名称。可以将每个其他参数放在旁边以将其作为参数传递。例如:
python.exe“ my_script.py” 1是“ Hello”
现在在您的python代码中,您可以像这样访问这些参数:
import sys
command_line_args = sys.argv[1::] # Cut the first one, it's only the current file name
for arg in command_line_args:
print(arg)