python基础框架搭建

搭建库文件

自己搭建库文件,然后在main文件中引用。具体的引用可以写:

同一目录下
import tool

tool.funciton1()
不同目录下
import sys
sys.path.append('tool文件的路径')
import tool

tool.funciton1()

pass函数

在写函数时,不确定函数的内容时,可以先在函数中写pass,可以让函数正确运行,但没有具体操作。

return函数

1.返回函数的结果
2.不会再执行下方的函数

print函数

如果print函数中要输出的文字过长,可以换行,但需要加引号:
不换行

print("Image this is a extremely long sentence that cannot display in one row. ")

换行

print("Image this is a extremely long sentence"
      "that cannot display in one row. ")

两种表示方法最终显示结果是相同的。

发布了3 篇原创文章 · 获赞 1 · 访问量 1367

猜你喜欢

转载自blog.csdn.net/shelley_hu/article/details/102545361