Python StdLib Tip
@pythonstdlibtip
Python built-in functions and modules tips, approximately one tip per week day. Shamelessly copied from http://docs.python.org by @dmlvianna.
Tal vez te guste
filter(function, iterable) Construct a list from those elements of iterable for which function returns true.
len(s) Return the length (number of items) of an object. The argument may be a sequence (string, tuple or list) or a mapping (dictionary).
iter(o[, x]) Return an iterator object. o must support iteration or sequencing. If x given, o must be callable and iteration will stop at x.
issubclass(class, classinfo) Return true if class is a subclass of classinfo. classinfo may be a tuple of class objects to be checked.
isinstance(object, class) Return true if the object is an instance of the class, or of a (direct, indirect or virtual) subclass thereof.
int(x) Convert a number or string x to an integer, or return 0 if no args. If x is floating point, the conversion truncates towards zero.
input([prompt]) Equivalent to eval(raw_input(prompt)). If readline is loaded, it provides elaborate line editing and history features.
id(object) This is an integer which is guaranteed to be unique and constant for this object during its lifetime.
hex(x) Convert an integer number (of any size) to a lowercase hexadecimal string prefixed with “0x”.
help([object]) Invoke the built-in help system. If no argument is given, the interactive help system starts on the interpreter console.
hash(object) Return the hash value of the object (if it has one). Hash values are integers, and are used to quickly compare dictionary keys.
hasattr(object, string) The result is True if the string is the name of one of the object’s attributes, False if not.
globals() Return a dictionary representing the current global symbol table. This is always the dictionary of the current module.
getattr(object, name[, default]) Return the value of the named attribute of object. If it does not exist, default is returned if provided.
frozenset([iterable]) Return a new frozenset object. frozenset is a built-in class. frozenset are like set objects, but are immutable.
format(value[, format_spec]) Convert a value to a “formatted” representation. format_spec mini-language: tinyurl.com/mtpo4l5
float([x]) Convert a string or a number to floating point. Strings can be embedded in whitespace. Argument may also be [+|-]nan or [+|-]inf.
file() Constructor function for the file type. Arguments are the same as for open(). Use open() to open files, use file() for type testing.
execfile(filename[, globals[, locals]]) This function is similar to the exec statement, but parses a file instead of a string.
eval(expression[, globals[, locals]]) Evaluates a string or code object as a Python expression using current or supplied namespaces.
United States Tendencias
- 1. Knicks 78.5K posts
- 2. Mariah 29.5K posts
- 3. NBA Cup 62.8K posts
- 4. Spurs 49.2K posts
- 5. Clarkson 8,726 posts
- 6. Tyler Kolek 7,406 posts
- 7. #NewYorkForever 4,789 posts
- 8. Wemby 27.4K posts
- 9. Brunson 24.4K posts
- 10. Josh Hart 5,999 posts
- 11. Thug 23.4K posts
- 12. Buck Rogers 2,884 posts
- 13. #LMD7 52.8K posts
- 14. Mitch 16K posts
- 15. Gil Gerard 2,838 posts
- 16. Thea 13.9K posts
- 17. Mike Brown 4,897 posts
- 18. Thibs 1,061 posts
- 19. #MAGMA 1,282 posts
- 20. Macklin Celebrini 2,089 posts
Something went wrong.
Something went wrong.