I have a code in which the user should pass something through raw_input, this works fine for strings less then one line,
but when I copy-paste a longer string, only the first line is passed by raw_input, how can I also past the rest of the string?
Kruptein
15
Posting Whiz in Training
Recommended Answers
Jump to PostYou can read multiple lines with multiple raw_input and have a function which tests if input is complete. Here is an example
def input_complete(input_list): if ";" in input_list[-1]: return True else: return False def get_input(prompt1, prompt2): L = list() prompt = prompt1 while True: L.append(raw_input(prompt)) if input_complete(L): …
Jump to PostIt will work only if you are expecting input with a minimal structure so that you can define a rule to test if the input is complete or if you must wait for another line. You can't replace the colon by enter because when you paste a text, raw input …
All 7 Replies
Gribouillis
1,391
Programming Explorer
Team Colleague
Kruptein
15
Posting Whiz in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
Kruptein
15
Posting Whiz in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
Kruptein
15
Posting Whiz in Training
Kruptein
15
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.