Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VB到Python的转换尝试_Python_Vb6 - Fatal编程技术网

VB到Python的转换尝试

VB到Python的转换尝试,python,vb6,Python,Vb6,我的任务是在工作中尝试将vb转换为python。我实际上不需要完成它,但试着看看我是否能完成。我在这里找到了一个很好的资源: 我只是在学习Python,所以我不是专家,但我认为这可能是一个有趣的练习。这是为在ArcGIS中使用而设计的 Public Property Get PageLayout_NewPolygon() As UID # from reference : There is also no concept of Public or # Private class

我的任务是在工作中尝试将vb转换为python。我实际上不需要完成它,但试着看看我是否能完成。我在这里找到了一个很好的资源:

我只是在学习Python,所以我不是专家,但我认为这可能是一个有趣的练习。这是为在ArcGIS中使用而设计的

Public Property Get PageLayout_NewPolygon() As UID
    # from reference : There is also no concept of Public or 
    # Private class members in Python. Everything is public...
    # Original VB Next Line - Commented Out
    # Dim u As New UID
    # Python Next Line - Reference : http://vb2py.sourceforge.net/docs/dim.html
    u = UID()
    u = "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" # Value Changed.
    # Original VB Next Line - Commented Out
    # Set PageLayout_NewPolygon = u
    # Python Next Line - Reference : http://vb2py.sourceforge.net/docs/set.html
    PageLayout_NewPolygon = u
End Property
# I don't think 'End' is needed in Python so this can be removed, right?
原始代码:防止混淆

Public Property Get PageLayout_NewPolygon() As UID
    Dim u As New UID
    obj = Collection()
    u = "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" ' Value Changed.
    Set PageLayout_NewPolygon = u
End Property

如果您能给我提些建议,我将不胜感激。

这只是一个思考练习吗?或者你真的希望以某种方式运行新代码吗?这是一个由四个文件组成的小路由程序。我只是在看一个,看看能不能转换。第一个文件包含上面的50个变量,其中PageLayout_NewPolygon被另一个变量替换。我希望运行它!:在这种情况下,您可能想看看程序作为一个整体在做什么,并重新创建它,而不是试图将VB的每一行都转换成Python。好的,Tom。对于学习如何为python项目构建行动计划,您有什么建议吗?它已经向我解释了它的作用,但我可能需要设计一个流程图,让我的头脑围绕它!听起来你已经有了一个好主意——花点时间精确地计算出现有代码没有做什么,尽量不要太关注它是如何做的,然后你可以决定整体布局是否合理/合适。如果是,那么您可以遵循类似的设计,例如类似的流程图,或者您可能决定做一些完全不同的事情。尝试将现有的应用程序分解为多个功能区域,看看是否可以单独创建每个应用程序。祝你好运,玩得开心!