• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

What book for python summary

foges

Senior member
Im relatively new to programing and i find that i often forget what a function is called (eg. how do you convert a character to its ansi number?) or what the format i need to enter things. So im looking for a book that will prety much list the all functions, formats, etc... with a short description of what it does and how use it. Any ideas?

Question 2: What is the best way to test for input types? (eg. testing that the input is actually is a number)

Thanks

 
The "Black Book" series from Coriolis is very good as a gneral reference (and includes some useful examples)

I've also found the O'Reilly "In a Nutshell" series to be very good (i.e., Python in a Nutshell" )

O'Reilly also has a series of "pocket" editions that are pretty much just command & function summaries.

Good Luck

Scott
 
Originally posted by: foges
Im relatively new to programing and i find that i often forget what a function is called (eg. how do you convert a character to its ansi number?) or what the format i need to enter things. So im looking for a book that will prety much list the all functions, formats, etc... with a short description of what it does and how use it. Any ideas?
http://docs.python.org is actually really good. There's a useful tutorial that also works as a reference for the basics and the library reference is good too. That along with the interactive interpreter work quite well for learning. The dir() function lists all the items present in a namespace (no args for the builtin namespace, 1 arg for all the members of whatever you pass in). Then use help() to see the documentation of whichever thing you want to learn about:

>>> dir()
['__builtins__', '__doc__', '__name__']
>>> dir(__builtins__)
['ArithmeticError', 'AssertionError', 'AttributeError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'IOError', 'ImportError', 'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'OverflowWarning', 'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UserWarning', 'ValueError', 'Warning', 'ZeroDivisionError', '_', '__debug__', '__doc__', '__import__', '__name__', 'abs', 'apply', 'basestring', 'bool', 'buffer', 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip']
>>> help(ord)
Help on built-in function ord in module __builtin__:

ord(...)
ord(c) -> integer

Return the integer ordinal of a one-character string.

Question 2: What is the best way to test for input types? (eg. testing that the input is actually is a number)

Thanks

try:
__myint = int(myinput)
except:
__# oh crap
 
The only Python book that I have is this one. It is very easy to understand and they give good examples on how to use various things. I didn't use it for much though because I find it much more helpful to just play around with things and use the help function in the Python IDLE. I'd recommend this book for people just starting out with Python, though.
 
Back
Top