Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75001 > unrolled thread
| Started by | Orochi <kartikjagdale11@gmail.com> |
|---|---|
| First post | 2014-07-22 09:06 -0700 |
| Last post | 2014-07-22 09:18 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
Fastest I/O on Python ? Orochi <kartikjagdale11@gmail.com> - 2014-07-22 09:06 -0700
Re: Fastest I/O on Python ? Chris Angelico <rosuav@gmail.com> - 2014-07-23 02:17 +1000
Re: Fastest I/O on Python ? emile <emile@fenx.com> - 2014-07-22 09:18 -0700
| From | Orochi <kartikjagdale11@gmail.com> |
|---|---|
| Date | 2014-07-22 09:06 -0700 |
| Subject | Fastest I/O on Python ? |
| Message-ID | <ac753254-9b33-457d-8ba9-92af4b063da4@googlegroups.com> |
Is there in any other input/output faster than ("raw_input","input" / "print")
As I am trying to solve competitive Programs on codechef.com using python i was wondering if there is any other way to print and scan the inputs fast.
I have seen other people codes and there are using sys library(stdin and stdout) for I/O.
So I was thinking is there any other way to take input/output besides using 'sys library'.
And also I had doubt about what is the difference between (raw_input,input/print) and (stdin/stdout)
Thank You.....
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-07-23 02:17 +1000 |
| Message-ID | <mailman.12183.1406045849.18130.python-list@python.org> |
| In reply to | #75001 |
On Wed, Jul 23, 2014 at 2:06 AM, Orochi <kartikjagdale11@gmail.com> wrote:
> Is there in any other input/output faster than ("raw_input","input" / "print")
> As I am trying to solve competitive Programs on codechef.com using python i was wondering if there is any other way to print and scan the inputs fast.
What do you mean by faster? Are you really seeing performance problems
with them, or are you actually looking for something like C's printf
and scanf, which do more than just output and input?
The print function (use either Python 3 or a future import) has some
good formatting facilities, and if you need more, you can do something
like this:
>>> print("The price is $%.2f per kilo." % 1.5)
The price is $1.50 per kilo.
However, there's no comparable feature for input. It's generally
easiest to take a string from (raw_)input and then parse it yourself,
maybe with a regular expression, or splitting it on whitespace, or
whatever else is appropriate.
But you'll really need to explain what you're actually having issues
with, before we can advise further.
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | emile <emile@fenx.com> |
|---|---|
| Date | 2014-07-22 09:18 -0700 |
| Message-ID | <mailman.12184.1406045913.18130.python-list@python.org> |
| In reply to | #75001 |
On 07/22/2014 09:06 AM, Orochi wrote:
> Is there in any other input/output faster than ("raw_input","input" / "print")
The limitation is with the device -- either the human typing in
responses or the output device rendering the output. If you have the
option to read/write to disk that'd open up additional options.
Otherwise I'm not sure there's much to be gained.
Emile
> As I am trying to solve competitive Programs on codechef.com using python i was wondering if there is any other way to print and scan the inputs fast.
>
>
> I have seen other people codes and there are using sys library(stdin and stdout) for I/O.
>
> So I was thinking is there any other way to take input/output besides using 'sys library'.
>
> And also I had doubt about what is the difference between (raw_input,input/print) and (stdin/stdout)
>
> Thank You.....
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web