Function raw_input usage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whatdakwah

    Function raw_input usage

    How does raw_input function work in general?
    Last edited by bvdet; Nov 4 '10, 09:49 AM. Reason: Clarify ttitle
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Function raw_input returns a string. Technically, raw_input reads a line of input from standard input (sys.stdin) and returns a string. If a prompt string is supplied, it is first printed to standard output (sys.stdout). Trailing newlines are stripped. If an EOF is read, an EOFError is raised.

    Example:
    Code:
    s = raw_input("What is your name?")
    print "Your name is %s." % (s)

    Comment

    Working...