Re: problems with Methods in Python 3.4.2
On 2017-09-25 23:17, claudemirxavie...@gmail.com wrote: Traceback (most recent call last): File "", line 1, in nome = input("Digite seu nome:") File "", line 1, in NameError: name 'rick' is not defined Estou com esse problema alguem me ajuda pfvr It looks like what you would get in Python 2. If you're using Python 2, use 'raw_input' instead of 'input'. -- https://mail.python.org/mailman/listinfo/python-list
Re: problems with Methods in Python 3.4.2
Traceback (most recent call last): File "", line 1, in nome = input("Digite seu nome:") File "", line 1, in NameError: name 'rick' is not defined >>> Estou com esse problema alguem me ajuda pfvr -- https://mail.python.org/mailman/listinfo/python-list
problems with Methods in Python 3.4.2
Hello Dears, I solved the problem: There are two underscore key strokes required. Marcus. Hello Dears, 1)I am trying to do this: >>> dir(_builtins_) I am getting this: Traceback (most recent call last): File "", line 1, in dir(_builtins_) NameError: name '_builtins_' is not defined 2)I am trying to do this: >>> 'TTA',_add_('GGA') Iam getting this : Traceback (most recent call last): File "", line 1, in 'TTA',_add_('GGA') NameError: name '_add_' is not defined 3)I am trying to do this: >>> -3 .abs() Iam getting this Traceback (most recent call last): File "", line 1, in -3 .abs() AttributeError: 'int' object has no attribute 'abs' 4) finally, after printing >>>abs._doc_() I am getting this (and so on) : Traceback (most recent call last): File "", line 1, in abs._doc_() AttributeError: 'builtin_function_or_method' object has no attribute '_doc_' What did I do wrong ? Thanks for help, Marcus Luetolf, M.D., 90 Bondastreet, CH-7000 Chur, Switzerland. --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: problems with Methods in Python 3.4.2
On 12/18/2014 12:27 PM, Marcus Lütolf wrote: Learn to use dir to fine valid names. 1)I am trying to do this: >>> dir(_builtins_) I am getting this: Traceback (most recent call last): File "", line 1, in dir(_builtins_) NameError: name '_builtins_' is not defined >>> dir() ['__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__'] shows the defined names. 2)I am trying to do this: 'TTA',_add_('GGA') I’am getting this : Traceback (most recent call last): File "", line 1, in 'TTA',_add_('GGA') NameError: name '_add_' is not defined >>> dir('a') shows string attribute names 3)I am trying to do this: -3 .abs() I’am getting this Traceback (most recent call last): File "", line 1, in -3 .abs() AttributeError: 'int' object has no attribute 'abs' dir(3) shows int attributes 4) finally, after printing >>>abs._doc_() I am getting this (and so on) : Traceback (most recent call last): File "", line 1, in abs._doc_() AttributeError: 'builtin_function_or_method' object has no attribute '_doc_' dir(abs) ditto What did I do wrong ? You did not use the interactive help already available. help() is also very useful. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: problems with Methods in Python 3.4.2
In =?iso-8859-1?Q?Marcus_L=FCtolf?= writes: > >>> dir(_builtins_) > >>> 'TTA',_add_('GGA') > >>>abs._doc_() These errors are due to using single underscores instead of double underscores. I.e. use __builtins__ instead of _builtins_. > >>> -3 .abs() > AttributeError: 'int' object has no attribute 'abs' Integer objects don't have a built-in function named abs(). If you want the absolute value of an integer, call abs directly, like so: abs(-3) -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'. -- https://mail.python.org/mailman/listinfo/python-list
Re: problems with Methods in Python 3.4.2
On 12/18/2014 09:27 AM, Marcus Lütolf wrote: Hello Dears, 1)I am trying to do this: >>> dir(_builtins_) It's __builtins__ not _builtins_ (double underscores at each end not single underscores) I am getting this: Traceback (most recent call last): File "", line 1, in dir(_builtins_) NameError: name '_builtins_' is not defined 2)I am trying to do this: >>> 'TTA',_add_('GGA') To call a method use "." not ",". And the method you are trying to call is __add__ not _add_. But why... just do "TTA"+"GGA" I’am getting this : Traceback (most recent call last): File "", line 1, in 'TTA',_add_('GGA') NameError: name '_add_' is not defined 3)I am trying to do this: >>> -3 .abs() abs is a function not a method. do: abs(-3) I’am getting this Traceback (most recent call last): File "", line 1, in -3 .abs() AttributeError: 'int' object has no attribute 'abs' 4) finally, after printing >>>abs._doc_() Again, use double underscores abs.__doc__() I am getting this (and so on) : Traceback (most recent call last): File "", line 1, in abs._doc_() AttributeError: 'builtin_function_or_method' object has no attribute '_doc_' What did I do wrong ? Thanks for help, Marcus Luetolf, M.D., 90 Bondastreet, CH-7000 Chur, Switzerland. -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list
Re: problems with Methods in Python 3.4.2
On Thursday, 18 December 2014 13:28:33 UTC-4, Marcus Lütolf wrote: > Hello Dears, > 1)I am trying to do this: > > >>> dir(_builtins_) You need two underscore characters on each sides: dir(__builtins__) > > I am getting this: > Traceback (most recent call last): > File "", line 1, in > dir(_builtins_) > NameError: name '_builtins_' is not defined > > 2)I am trying to do this: > > >>> 'TTA',_add_('GGA') Same; magic methods have two underscore characters on each side. > > I'am getting this : > Traceback (most recent call last): > File "", line 1, in > 'TTA',_add_('GGA') > NameError: name '_add_' is not defined > > 3)I am trying to do this: > > >>> -3 .abs() abs(-3) abs is a function in Python. See http://lucumr.pocoo.org/2011/7/9/python-and-pola/ for a good explanation... > > I'am getting this > Traceback (most recent call last): > File "", line 1, in > -3 .abs() > AttributeError: 'int' object has no attribute 'abs' > > 4) finally, after printing > > >>>abs._doc_() > Guess why! ;-) > I am getting this (and so on) : > Traceback (most recent call last): > File "", line 1, in > abs._doc_() > AttributeError: 'builtin_function_or_method' object has no attribute '_doc_' > > What did I do wrong ? Thanks for help, Marcus Luetolf, M.D., 90 Bondastreet, > CH-7000 Chur, Switzerland. > > > > > > > > > > > > > > > > Diese E-Mail wurde von Avast Antivirus-Software > auf Viren geprüft. > > www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
problems with Methods in Python 3.4.2
Hello Dears, 1)I am trying to do this: >>> dir(_builtins_) I am getting this: Traceback (most recent call last): File "", line 1, in dir(_builtins_) NameError: name '_builtins_' is not defined 2)I am trying to do this: >>> 'TTA',_add_('GGA') Iam getting this : Traceback (most recent call last): File "", line 1, in 'TTA',_add_('GGA') NameError: name '_add_' is not defined 3)I am trying to do this: >>> -3 .abs() Iam getting this Traceback (most recent call last): File "", line 1, in -3 .abs() AttributeError: 'int' object has no attribute 'abs' 4) finally, after printing >>>abs._doc_() I am getting this (and so on) : Traceback (most recent call last): File "", line 1, in abs._doc_() AttributeError: 'builtin_function_or_method' object has no attribute '_doc_' What did I do wrong ? Thanks for help, Marcus Luetolf, M.D., 90 Bondastreet, CH-7000 Chur, Switzerland. --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list