Pasting multiple lines into IDLE

Probably not the most beautiful procedure, but this works:

cmds=""'

paste your commands, followed by ''':

a = 1
b = 2
c = 3
'''

Then exec(cmds) will execute them.

Or more directly,

exec('''

then paste your commands, followed by '''):

a = 1
b = 2
c = 3
''')

It’s just a trick, maybe there’s a more official, elegant way.

Leave a Comment