Home > Backend Development > Python Tutorial > pycharm 使用心得(八)如何调用另一文件中的函数

pycharm 使用心得(八)如何调用另一文件中的函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-16 08:44:01
Original
1960 people have browsed it

实现步骤:

1. PyCharm, IDE有个Project setting图标,是给run图标做配置的,配置run file为myfile.py
2.

复制代码 代码如下:

# --------------------------------------
#! /usr/bin/python
# File: myfile.py
# Author: Michael Fan


from make.py import do


def main():
do()


if __name__ == '__main__':
main()
# --------------------------------------

3.

复制代码 代码如下:

mic@ubt: ~$ ls
> make.py myfile.py

mic@ubt: ~$ ./myfile.py
> Hello, world!

Related labels:
Statement of this Website
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
Latest Issues
Why not use Pycharm
From 1970-01-01 08:00:00
0
0
0
python - pycharm startup error
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template