简体   繁体   中英

How to run 'quit command' for terminal from PyCharm? For Mac

How can I run command for terminal from PyCharm?

For example, next command:

osascript -e 'quit app "/Applications/Google Chrome.app"'

No problem to run it from terminal, but because of the quotation marks I receive error in PyCharm. I wrote next:

os.system ('osascript -e 'quit app "/Applications/Google Chrome.app"'')

And failed.

Is there any solution?

You can wrap the string in """(3 double quotes)
eg

"""osascript -e 'quit app "/Applications/Google Chrome.app"'"""

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM