Python Forum
How to paste several lines of codes to the Python console
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to paste several lines of codes to the Python console
#14
IPython as mention or ptpython(as i used for many years now).
Can paste in almost all code into ptpython and it works,and can continue to test.
For Windows in make much better in use cmder in combo with ptpython.
ptpython can also go in change code that has been paste and look at run code that has been paste in before(F3).
class Game:
    def __init__ (self, title, year, price):
        self.title = title
        self.year = year
        self.price = price

    def __str__(self):
        return f'{self.title}, {self.year}, {self.price}'

    def __repr__(self):
        return f'Game({self.title}, {self.year}, {self.price})'

g1 = Game("FIFA", 2008, "€50")
print(g1)
[Image: aev8Z7.png]

Also remember the -i command this work for all interactive shell.
python --help
.....
-i     : inspect interactively after running script; forces a prompt even
         if stdin does not appear to be a terminal; also PYTHONINSPECT=x
[Image: p0ILWq.png]
22_alias likes this post
Reply


Messages In This Thread
RE: How to paste several lines of codes to the Python console - by snippsat - Jan-12-2021, 02:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with Spyder IDE: Clear console doesn't actually clear the console GalacticStarfish 2 5,694 Sep-03-2017, 09:01 PM
Last Post: dvs1

Forum Jump:

User Panel Messages

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