Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: type() gives blank result

Tags:

python

types

What does it mean when I do

print type(foo)

and get absolutely nothing?

foo is the response from an eBay REST search query, and it's supposed to be XML according to the eBay docs. When I

print foo

I get stuff -- a long string of values about ebay items all butted-up against one another.

like image 740
themirror Avatar asked Dec 28 '10 05:12

themirror


People also ask

What does type () return in Python?

Python type() The type() function either returns the type of the object or returns a new type object based on the arguments passed.

Why output is blank in Python?

You need to call the function myFirstSubroutine() to get the output. Pay attention to that lowercase letter variable is not equal to capital letter variable in Python. That means you need to use exact the function name myFirstSubroutine() .

What is type () in Python?

Syntax of the Python type() function The type() function is used to get the type of an object. Python type() function syntax is: type(object) type(name, bases, dict) When a single argument is passed to the type() function, it returns the type of the object. Its value is the same as the object.

What is type () in Python give an example?

Answer. Python type() is a built-in function that is used to return the type of data stored in the objects or variables in the program. For example, if a variable contains a value of 45.5 then the type of that variable is float.


1 Answers

It means type is a function or other callable object that returns an empty string. Since the built-in function doesn't do that, you have most likely called another function type(). Change the name of that function to something else. type_() is good. Or _type(), or somethingtype().

like image 59
Lennart Regebro Avatar answered Sep 19 '22 00:09

Lennart Regebro