You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
632 B

from os import system
import subprocess
import asyncio
def showNotepad1():
try:
subprocess.run(['Notepad.exe',])
except subprocess.CalledProcessError as e:
print(e.output)
async def showNotepad2():
try:
await asyncio.create_subprocess_exec('notepad.exe')
except subprocess.CalledProcessError as e:
print(e.output)
async def main():
print ("inicio llamada síncrona")
showNotepad1()
print ("fin llamada síncrona")
print ("inicio llamada asíncrona")
await showNotepad2()
print ("fin llamada asíncrona")
print("pulsa una tecla para terminar")
system ('Pause')
asyncio.run(main())

Powered by Informatica FP.