Python脚本到批处理文件 [英] Python script to Batch file

查看:100
本文介绍了Python脚本到批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行python脚本的批处理文件.我正在运行Python 3.2.我想将python脚本中的整数或字符串之类的变量发送回批处理文件,这可能吗?

I have a batch file that runs a python script. I am running Python 3.2. I want to send a variable like an integer or string from the python script back to the batch file, is this possible?

我知道我可以使用sys.argv接受Python脚本中的命令行参数.希望有一些功能可以让我做相反的事情.

I know I can accept command line arguments in the Python script with sys.argv. Was hoping there was some feature that allows me to do the reverse.

推荐答案

您不能发送"字符串.您可以打印出来并让调用过程捕获它,但是您只能直接返回0到255之间的数字.

You can't "send" a string. You can print it out and have the calling process capture it, but you can only directly return numbers from 0 through 255.

这篇关于Python脚本到批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆