Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3331
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <andrea.crotti.0@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'anyway': 0.03; 'lines.': 0.05; 'received:134': 0.05; 'typing': 0.05; 'python': 0.07; 'header:In-reply-to:1': 0.09; 'newline': 0.09; '"invalid': 0.16; '"normal"': 0.16; '"while': 0.16; '10:': 0.16; 'history.': 0.16; 'subject:] ': 0.16; 'command': 0.19; 'writes:': 0.20; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'cheers,': 0.20; 'seems': 0.21; 'code': 0.22; 'cc:addr:python- list': 0.22; 'e.g.': 0.22; "what's": 0.24; "i'm": 0.26; "doesn't": 0.28; 'error': 0.29; 'hi,': 0.29; 'message-id:@gmail.com': 0.30; 'cc:addr:python.org': 0.31; 'using': 0.34; 'difference': 0.35; 'print': 0.35; 'header:User-Agent:1': 0.35; 'running': 0.36; 'data': 0.37; 'commands': 0.38; 'execute': 0.38; 'results.': 0.38; 'goes': 0.38; 'but': 0.38; 'used': 0.38; 'received:de': 0.39; 'how': 0.39; 'works': 0.40; 'would': 0.40; 'anything,': 0.73; 'subject:line': 0.73; "'e'": 0.84; 'subject:commands': 0.84; 'want:': 0.84 |
| MIME-version | 1.0 |
| Content-transfer-encoding | 7BIT |
| Content-type | text/plain |
| X-IronPort-AV | E=Sophos;i="4.64,224,1301868000"; d="scan'208";a="106906942" |
| From | Andrea Crotti <andrea.crotti.0@gmail.com> |
| To | Phil Winder <philipwinder@gmail.com> |
| Subject | Re: [Q] ipython: Multiple commands on the same line and newlines |
| References | <8dc6c9e4-e50e-401f-95d9-42f80a90196c@l30g2000vbn.googlegroups.com> |
| Date | Sat, 16 Apr 2011 18:29:20 +0200 |
| In-reply-to | <8dc6c9e4-e50e-401f-95d9-42f80a90196c@l30g2000vbn.googlegroups.com> |
| User-Agent | Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.432.1302971361.9059.python-list@python.org> (permalink) |
| Lines | 52 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1302971361 news.xs4all.nl 41103 [::ffff:82.94.164.166]:59814 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:3331 |
Show key headers only | View raw
Phil Winder <philipwinder@gmail.com> writes: > Hi, > I'm having a go at using ipython as a command prompt for data > analysis. Coming from Matlab, I'm used to typing multiple commands on > the same line then using the up arrow to go through my history. > How can I write multiple python commands on the same line? > E.g. "x = 0; while x < 10: x = x + 1;" returns an "invalid syntax" > error on the 'e' in while. > > Also, how can I produce a new line, without it running the command? I > would have expected a ctrl-enter or shift-enter to produce the > expected results. > E.g. I want: > "x = 0; <ctrl-enter> > while x < 10: <ctrl-enter> > x = x + 1; <ctrl-enter> > " <enter to run> > It seems to work automatically for the "while xxx:", but combinations > of keys+enter do not work for "normal" lines. > > Cheers, > Phil Well when you do something like while x < 10: it doesn't execute anything, but goes to newline and waits for the rest. for x = 10 what's the difference for you if it gets evaluated before or after? Anyway you can you also %cpaste if you want to write more code Anyway to me this works perfectly: In [1]: x = 0 In [2]: while x < 10: print x; x += 1 ...: 0 1 2 3 4 5 6 7 8 9
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
[Q] ipython: Multiple commands on the same line and newlines Phil Winder <philipwinder@gmail.com> - 2011-04-16 06:55 -0700
Re: [Q] ipython: Multiple commands on the same line and newlines Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-04-16 18:29 +0200
Re: ipython: Multiple commands on the same line and newlines Phil Winder <philipwinder@gmail.com> - 2011-04-16 09:37 -0700
Re: ipython: Multiple commands on the same line and newlines Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-04-17 14:11 +0200
Re: ipython: Multiple commands on the same line and newlines Phil Winder <philipwinder@gmail.com> - 2011-04-17 11:40 -0700
Re: ipython: Multiple commands on the same line and newlines Alexander Kapps <alex.kapps@web.de> - 2011-04-17 21:39 +0200
Re: [Q] ipython: Multiple commands on the same line and newlines Chris Angelico <rosuav@gmail.com> - 2011-04-17 02:33 +1000
Re: [Q] ipython: Multiple commands on the same line and newlines Terry Reedy <tjreedy@udel.edu> - 2011-04-16 12:39 -0400
Re: [Q] ipython: Multiple commands on the same line and newlines harrismh777 <harrismh777@charter.net> - 2011-04-18 01:01 -0500
Re: [Q] ipython: Multiple commands on the same line and newlines Chris Angelico <rosuav@gmail.com> - 2011-04-18 16:12 +1000
Re: [Q] ipython: Multiple commands on the same line and newlines "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-04-17 04:22 +0000
csiph-web