Python 3.4.2语法E

2024-05-19 21:14:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试在python上构建一个分发文件。 这是我的代码:

Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

>>> def print_list( AList ):
        for item in AList:
           if ( isinstance( item, list )):
               print_list( item )
           else:
               print( item )

这是我的安装文件:

^{pr2}$

我确实在执行以下步骤:

  1. 打开命令
  2. 转到我的文件夹:“cd c:\users……\nester”(nester是我的文件夹)
  3. 写下“c:\python34\python.exe设置.pysdist“

它给了我一个错误:

“文件”设置.py“在第1行
Python3.4.2(v3.4.2:ab2c023a942232014年10月6日22:15:05)[MSC v.1600 32位(Intel)]在win32上 语法错误:无效的sintax

所以我试图删除两个文件中的第一行和第二行代码,但错误仍然存在。在

你知道发生了什么吗?在

谢谢你的帮助!在


Tags: 文件代码文件夹for错误itemoctlist
1条回答
网友
1楼 · 发布于 2024-05-19 21:14:51

您已经将粘贴的代码从python解释器复制到setup.py文件中,这会带来一些额外的垃圾(解释器状态消息):

Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

请将其以及>>>标记从setup.py中删除。以后请注意,您不能直接从解释器复制粘贴到.py文件中。在

相关问题 更多 >