scanf(%d%d,&x&y) in python. How can I do it?
Sergio_5 0
Newbie Poster
Recommended Answers
Jump to PostUsually you don't do it, you read and parse the input file by various means, for example
…>>> import io >>> stdin = io.StringIO("""34 78""") >>> line = stdin.readline() >>> line '34 78' >>> x, y = (int(s) for s in line.split()[:2]) >>> x, y (34, 78)
Jump to PostAre you actually unable to read any of the dozens of books or hundreds of introductory web sites that show you how to do this? You are too lazy to Google this yourself, but you expect someone here to spoon feed you the answer to such a simple question.
All 6 Replies
rproffitt 2,572
"Nothing to see here." Moderator
Gribouillis 1,391
Programming Explorer Team Colleague
Sergio_5 0
Newbie Poster
Reverend Jim 4,780
Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
rproffitt
commented:
Maybe it's that new code system of "alternate teaching methods." +11
Sergio_5 0
Newbie Poster
Reverend Jim 4,780
Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
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.