1

what I want is something like this: The first file just prints as soon as the 2nd has read

# a.py
print('pepe')
# wait till the other had read
print(23)

The second program uses data from the later

# b.py
name = input()
age = int(input())
print('Hi ' + name + ', you are ' str(age))

So I can see in the console:

Hi pepe, you are 23

I want to do this because, I waste a lot of time typing in the console. And I want to do it automatically.

Just in case, I browsed for this thing a long time, but no idea, that is why I decided to ask here.

z_tjona
  • 490
  • 1
  • 4
  • 6
  • I added visual studio code and spyder because those are the IDEs I have used, so an answer on those ones would be the best. – z_tjona Dec 09 '18 at 03:27
  • Your program isn't complete, but I made a python class making patching easy. [PatchBay 0.1](https://github.com/TedLyngmo/patchbay) – Ted Lyngmo Dec 09 '18 at 03:35

1 Answers1

0

A couple of different ways.

1) while True: an infinite loop that requires you to use some sort of

while True:
    cmd = input("type something")
    if cmd == 'e':
        do something
    elif cmd == 'f':
        do something else
    else:
        do that last thing

2) input("press enter to continue")

input('press enter to continue')

Hopefully that gets you what you need...

You can also learn more here: How do I make python to wait for a pressed key

JBB
  • 176
  • 1
  • 4