Error:
File “<string>”, line 1
while True: inp = input(‘Directory: ‘); if inp == ‘1’: print(‘Continue’); break; else: print(‘Wrong’)
^^
SyntaxError: invalid syntax
(the ^^ are under the if)
code:
import subprocess def main(): command = ( 'python -c "while True: ' 'inp = input('Directory: '); ' 'if inp == '1': ' ' print('Continue'); ' ' break; ' 'else: ' ' print('Wrong')"' ) command2 = 'echo 2' subprocess.run(f'start cmd /k {command}', shell=True) subprocess.run(f'start cmd /k {command2}', shell=True) main()
submitted by /u/Imaginary_History789
[link] [comments]
r/learnpython Error: File “<string>”, line 1 while True: inp = input(‘Directory: ‘); if inp == ‘1’: print(‘Continue’); break; else: print(‘Wrong’) ^^ SyntaxError: invalid syntax (the ^^ are under the if) code: import subprocess def main(): command = ( ‘python -c “while True: ‘ ‘inp = input(‘Directory: ‘); ‘ ‘if inp == ‘1’: ‘ ‘ print(‘Continue’); ‘ ‘ break; ‘ ‘else: ‘ ‘ print(‘Wrong’)”‘ ) command2 = ‘echo 2′ subprocess.run(f’start cmd /k {command}’, shell=True) subprocess.run(f’start cmd /k {command2}’, shell=True) main() submitted by /u/Imaginary_History789 [link] [comments]
Error:
File “<string>”, line 1
while True: inp = input(‘Directory: ‘); if inp == ‘1’: print(‘Continue’); break; else: print(‘Wrong’)
^^
SyntaxError: invalid syntax
(the ^^ are under the if)
code:
import subprocess def main(): command = ( 'python -c "while True: ' 'inp = input('Directory: '); ' 'if inp == '1': ' ' print('Continue'); ' ' break; ' 'else: ' ' print('Wrong')"' ) command2 = 'echo 2' subprocess.run(f'start cmd /k {command}', shell=True) subprocess.run(f'start cmd /k {command2}', shell=True) main()
submitted by /u/Imaginary_History789
[link] [comments]