20th February 2013 - LPTHW - Learnings

  1. On Windows to learn about any command of Python, to be typed -: python -m pydoc COMMAND NAME. This gives out the description of the command. To quit Pydoc, press "q".
  2. .py files can be simply called scripts.
  3. Adding new feature to a Python program is done by using "import" feature. The real name of theirs is modules and not features though. It adds the feature you have called for to the program. Instead of keeping all the features always, Python gives the option to call them, whenever needed. It keeps the program small and also acts as documentation later.
  4. "argv" is the argument variable, which contains the argument which we pass while running the program.
  5. "unpacking" argv is basically taking everything that has been passed in the argv and assigning them to the variables mentioned in the program. Like - : script, first, second, third = argv
  6. The other name of modules is libraries.
  7. If the user has to give the input on command line then argv is used, otherwise raw_input is used if the input is passed while the script is running.
  8. EX14 - QUE - 5. Did not understand why a variable called "prompt" was defined earlier and then used with raw_input, the code runs exactly the same without using the variable in raw_input ?
  9.  open  command can take a parameter, and return a value which we can set into our own variable.
  10. When we open a file, we get the file which can be passed a command , followed by dot and the name of the command and the parameter.
  11. commands are also called functions and methods.
  12. open(filename)  basically creates a "file object", it can be read but it is not the contents.