Python: Difference between revisions

From Halfface
Jump to navigation Jump to search
Line 9: Line 9:
  print "Hello, World!"
  print "Hello, World!"
command called print followed by one argument,which is "Hello, World!". (referred to as a string of characters, or string) Command and its arguments are collectively referred to as a statement,
command called print followed by one argument,which is "Hello, World!". (referred to as a string of characters, or string) Command and its arguments are collectively referred to as a statement,
print "2 + 2 is", 2 + 2 The first argument is the string "2 + 2 is" and the second argument is the mathematical expression 2 + 2, which is commonly referred to as an expression


  sys.argv  arguments are passed to the script in the variable sys.argv
  sys.argv  arguments are passed to the script in the variable sys.argv
  #          is used to start a comment
  #          is used to start a comment

Revision as of 21:16, 5 October 2011

links

http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_2.6
http://docs.python.org/tutorial

Reference

http://docs.python.org/ref/ref.html

basics

print "Hello, World!"

command called print followed by one argument,which is "Hello, World!". (referred to as a string of characters, or string) Command and its arguments are collectively referred to as a statement,

print "2 + 2 is", 2 + 2 The first argument is the string "2 + 2 is" and the second argument is the mathematical expression 2 + 2, which is commonly referred to as an expression

sys.argv   arguments are passed to the script in the variable sys.argv
#          is used to start a comment