我想知道Python模块是如何工作的?假设我想让我的Python程序使用一些自定义模块与它打包,我将它们放在主.py文件中?(如果不使用常规方法,我将如何加载它们?)
我遇到了这个Python程序的问题我正在创建数学,工作和解决方案,但我得到语法错误:"python中的行后续字符意外的字符"
这是我的代码
print("Length between sides: "+str((length*length)*2.6)+" \ 1.5 = "+str(((length*length)*2.6)\1.5)+" Units")
Run Code Online (Sandbox Code Playgroud)
我的问题是\ 1.5我试过\ 1.5但它不起作用
使用python 2.7.2
我一直试图找到一个模块的位置,但我不能搜索python文件夹但仍然无法找到它但我知道它在那里
>>> import math
>>> math.__path__
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
math.__path__
AttributeError: 'module' object has no attribute '__path__'
>>> math.__file__
Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
math.__file__
AttributeError: 'module' object has no attribute '__file__'
Run Code Online (Sandbox Code Playgroud)