Home  >  Article  >  Backend Development  >  Mixed programming of batch processing and python code

Mixed programming of batch processing and python code

高洛峰
高洛峰Original
2017-03-02 16:20:101947browse

Batch processing can be easily mixed with other languages ​​for programming. In addition to being fun, it also has considerable practical value. For example, the Windows version of the ruby ​​gem package manager uses a mixture of batch processing and ruby, produced by bathome. The command tool package manager bcn is implemented using a mix of bat+jscript.

There are posts in the cn-dos and bathome forums that introduce and demonstrate mixed programming of batch processing and scripts in various languages. If you are interested, you can search for it.

Python is not picky about file suffixes. As long as the program contains the correct python code, it can be interpreted and executed by the python interpreter.

The mixed programming method of batch processing and python is very simple. Save it as xx.bat. The code is as follows:

"""
::=================这是注释
::批处理与python程序的混合编程
::2016年5月18日 14:26:03 codegay
::下面写批处理代码
@echo off&cls
echo batch echo
python.exe %0&pause
::=================这是注释
"""
#下面写你的python代码
print("python print")
#如果需要python输出中文,需要把文件存为UTF8
print("中文")

The above is the relevant knowledge introduced by the editor to you about the mixed programming method of batch processing and python code. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank you all for your support of the PHP Chinese website!


For more articles related to mixed batch processing and python code programming, please pay attention to the PHP Chinese website!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn