Python Forum
How can I create a multiline input in ipython?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I create a multiline input in ipython?
#1
Dear all

I am working with the book Python Data Science Handbook by Jake VanderPlas. The author uses ipython in the book.

There are some code examples where the input consists of multiple lines (without execution). For example:

In[1]: L = list(range(10))
       L 
Out[1]: [0,1,2,3,4,5,6,7,8,9]
How can I type that in that without executing the first line (when hitting enter)? enter+shift does not work, I have tried that out.

Thanks for your help!
Reply
#2
You are at the command line, so what you type will be executed.
To create a program and then run it I'd recommend using an IDE. Anaconda Spyder uses iPython as its engine and is a good IDE where you can create programs, then run them. Similarly, Jupyter Notebook (also part of Anaconda world)will give that same functionality.
Reply
#3
If you think about your question ('How can I type that in that without executing the /../ line') then answer is quite obvious: you comment this line out (or delete altogether).

If you mean something else by 'without executing' then please clarify.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#4
Ok, thanks @jefsummers, @perfringo
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  IPython errors for numpy array min/max methods muelaner 1 554 Nov-04-2023, 09:22 PM
Last Post: snippsat
  capturing multiline output for number of parameters jss 3 808 Sep-01-2023, 05:42 PM
Last Post: jss
  Can a program execute code in iPython shell and get result? deanhystad 3 1,725 Jun-17-2022, 03:45 AM
Last Post: Larz60+
  Presenting multiline data into single line aaronbuhu 1 1,800 Aug-05-2021, 10:57 AM
Last Post: jamesaarr
  Multiline comments macfanpl 6 2,733 May-07-2020, 08:14 PM
Last Post: macfanpl
  IPython console vs Spyder script losc 3 2,715 Apr-30-2020, 04:57 AM
Last Post: deanhystad
  ipython autocomplete broke indentation! Exsul 6 4,520 Aug-20-2019, 01:29 AM
Last Post: Exsul
  How do I create a user input for three integers in a range or just the stop input Pleiades 3 3,080 Nov-22-2018, 02:19 PM
Last Post: Larz60+
  Change values in string multiline DavidFernandez 4 3,084 Aug-26-2018, 08:09 PM
Last Post: buran
  How to clear IPython console in Spyder? Vai 7 55,888 Aug-20-2018, 09:43 PM
Last Post: james_balcomb

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020