FALL3N 0 Junior Poster in Training

I want to run a multiline AppleScript command from a Python script. For a singleline command I can do:

def stupidtrick():
    os.system(cmd)
    
cmd = """osascript -e 'tell app "Finder" to sleep'"""
stupidtrick();

however I want to run multiline commands, (such as with multiple 'tell' statements, as in tell application "iCal" and on the next line, tell calendar "default" but the same 'set' of commands..

in some other language it was something like:

"code \n"
+ "line2code \n"
+ "line3code \n";

how do I accomplish this in python?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.