繁体   English   中英

Python 导入语句中的双下划线是什么意思?

[英]What does a double underscore mean in a Python import statement?

Amazon Neptune 的文档包含以下代码示例。

from __future__  import print_function  # Python 2/3 compatibility

from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection

graph = Graph()

remoteConn = DriverRemoteConnection('wss://your-neptune-endpoint:8182/gremlin','g')
g = graph.traversal().withRemote(remoteConn)

print(g.V().limit(2).toList())
remoteConn.close()

问题:第 4 行中的双下划线是什么意思?

由于这是在导入语句中使用的,因此它必须以某种方式不同于Python class 定义中的“名称修改” 我只是不清楚它打算做什么。

这没什么特别的。 您可以在线找到代码,并在正在导入的 package 中看到具有该名称的 class。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM