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

yipeiwu_com7年前Python基础

实现步骤:

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!

相关文章

Python字符串替换实例分析

本文实例讲述了Python字符串替换的方法。分享给大家供大家参考。具体如下: 单个字符替换 s = 'abcd' a = ["a", "b", "c"] b = ["c", "d",...

Python中return语句用法实例分析

本文实例讲述了Python中return语句用法。分享给大家供大家参考。具体如下: return语句: return语句用来从一个函数 返回 即跳出函数。我们也可选从函数 返回一个值 。...

python求最大值最小值方法总结

python求最大值最小值方法总结

方法一(常规): 代码: count = int(input('输入数据个数:\n')) a = 1 while a <= count: num = int(input(...

python实现QQ邮箱/163邮箱的邮件发送

python实现QQ邮箱/163邮箱的邮件发送

QQ邮箱/163邮箱的邮件发送:py文件发送邮件内容相当于一个第三方的客户端,借助于QQ/163邮箱服务器来发送的邮件。 主要配置: 导入模块——import  ...

python 实现红包随机生成算法的简单实例

实例如下: </pre><pre name="code" class="python">#! /usr/bin/python # -*- coding: ut...