raw-input

How to use raw_input with argv?

How to use raw_input with argv? Question: I’m doing ex13 from Learn Python The Hard Way I’m trying to pass: python ex13.py raw_input() raw_input() raw_input() my code is below: from sys import argv script, first, second, third = argv print “The script is called:”, script print “Your first variable is:”, first print “Your second variable …

Total answers: 9

Time duration of user input

Time duration of user input Question: I’d like to know how long it takes a user to enter an input that I record with raw_input(). I.e. does it take them 1 second or 10 seconds to enter something on the command line. Is there an established way of doing this, or would I need to …

Total answers: 5

Inputs and user input validation

Inputs and user input validation Question: I have researched this question on here I have found similar question but this is different. I need to validate user input in the piece of code I am working on needs to print an error if the user input is either under 0 (This I have working fine) …

Total answers: 5

Maximum characters that can be stuffed into raw_input() in Python

Maximum characters that can be stuffed into raw_input() in Python Question: For an InterviewStreet challenge, we have to be able to accomodate for a 10,000 character String input from the keyboard, but when I copy/paste a 10k long word into my local testing, it cuts off at a thousand or so. What’s the official limit …

Total answers: 3

Backwards-compatible input calls in Python

Backwards-compatible input calls in Python Question: I was wondering if anyone has suggestions for writing a backwards-compatible input() call for retrieving a filepath? In Python 2.x, raw_input worked fine for input like /path/to/file. Using input works fine in this case for 3.x, but complains in 2.x because of the eval behavior. One solution is to …

Total answers: 4

Tab completion in Python's raw_input()

Tab completion in Python's raw_input() Question: i know i can do this to get the effect of tab completion in python sure. import readline COMMANDS = [‘extra’, ‘extension’, ‘stuff’, ‘errors’, ’email’, ‘foobar’, ‘foo’] def complete(text, state): for cmd in COMMANDS: if cmd.startswith(text): if not state: return cmd else: state -= 1 readline.parse_and_bind(“tab: complete”) readline.set_completer(complete) raw_input(‘Enter …

Total answers: 5