简体   繁体   English

尝试使用Mac OS X Terminal在Python中将对象分配给类时的语法错误

[英]Syntax error when trying to assign objects to class in Python using Mac OS X Terminal

I am learning python programming and I am just going through easy exercises. 我正在学习python编程,并且正在通过简单的练习。 One of them has me create a class as follows: 其中之一让我创建了一个如下类:

class MyFirstClass:
    Pass

That is it. 这就对了。 I save this and then when I try to import the file using python3.3 in a Mac Terminal and assign an object: 我保存了这个,然后当我尝试在Mac Terminal中使用python3.3导入文件并分配一个对象时:

a = MyFirstClass()

I get a syntax error. 我收到语法错误。 Am I not running the program correctly? 我不能正确运行程序吗? I have performed this task in IDLE but it does not seem to work when I am using Python in the terminal. 我已经在IDLE中执行了此任务,但是当我在终端中使用Python时它似乎不起作用。

Python is case-sensitive. Python区分大小写。 Pass should be pass . Pass应该是pass

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

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