~$ python
Python 2.7.4 (default, Apr 19 2013, 18:28:01)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from something import yourfunc
>>> yourfunc(a,b,c,d)
你看不到这个确切的文本,但是类似的东西:YMMV。你知道吗
完整示例:
这是有什么事吗地址:
def funcA(): return 'A'
def twice(n): return 2 * n
def swap(a, b): return b, a
现在您在shell中的目录与有什么事吗(在我的例子中~/stackoverflow):
~/stackoverflow$ python
Python 2.7.4 (default, Apr 19 2013, 18:28:01)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from something import twice, swap
>>> twice(24)
48
>>> swap(1,2)
(2, 1)
>>>
启动解释器并导入模块。你知道吗
你看不到这个确切的文本,但是类似的东西:YMMV。你知道吗
完整示例:
这是有什么事吗地址:
现在您在shell中的目录与有什么事吗(在我的例子中
~/stackoverflow
):如果有各种python安装,请调用所需的安装,例如
python2.7
、python3.3
、python3.4
。或者指向其中一个的链接,例如在我的盒子上(/usr/bin/)python
指向python2.7
的链接和(/usr/bin/)python3
指向python3.3
的链接。你知道吗您需要在模块中设置一些特殊的内容,以便能够从命令提示符调用其中包含的函数。比如:
现在:
结果:
相关问题 更多 >
编程相关推荐