You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can build UI using SwiftUI or UIKit and pass user input to Python code.
but How to maintain the python running environment? When I receive a prompt to 'send something' and then enter a number, continue executing the subsequent python code?
I see. So you want to keep using standard input/output. I guess it's possible but not easy. You can make a Pipe object and replace file descriptors of standard input/output with pipe's. Then either handle events or utilize async/await.
Activity
Sunny-guangge commentedon Feb 29, 2024
def main():
# print('00')
n1 = 10
n2 = 20
print(n1, '+', n2, '= ?')
a = input('send something')
a = int(a)
b = n1 + n2
if b == a:
print('good!')
else:
print('sorry', b)
in ios project how to implement the input function
kewlbear commentedon Mar 4, 2024
You can build UI using SwiftUI or UIKit and pass user input to Python code.
Sunny-guangge commentedon Mar 11, 2024
but How to maintain the python running environment? When I receive a prompt to 'send something' and then enter a number, continue executing the subsequent python code?
kewlbear commentedon Mar 11, 2024
I see. So you want to keep using standard input/output. I guess it's possible but not easy. You can make a Pipe object and replace file descriptors of standard input/output with pipe's. Then either handle events or utilize async/await.