New for Code by Zapier: Now Supporting Python 3.7

Deborah Tennen
Deborah Tennen / February 4, 2019

Code by Zapier allows you to run code in response to any trigger that Zapier supports. For example, you can use custom regular expressions to extract extra data like emails or tracking numbers from large text blobs, or you can make an extra API call to a different service with requests without building a full dev app.

And now, Code by Zapier supports up to Python 3.7. This is an important milestone, since by the end of the year, Python 2.7 will no longer be officially supported.

How does that change things? Python 3 introduces many new syntax and features. Some highlights:

  • It now supports f-strings, e.g.,
   name = "zapier"
   uppercased_greeting = f"Hi {name.upper()}"
  • The print statement is deprecated and replaced with the print function. If you’re used to using print var1, it should now become print(var1).

  • New syntax when it comes to raising exceptions.

You might be familiar with the old syntax of raising exceptions, for example:

    raise  Exception, “Number must be greater than 0”

This old syntax no longer works in Python 3. The new syntax is as follows:

   raise Exception(“Number must be greater than 0”)
  • New syntax when it comes to catching exceptions.

Related to the previous point, when you’re catching exceptions, the old syntax no longer works:

   except Exception, e:

The new syntax looks like the following:

   except Exception as e:

Take a look at the documentation for Python 3.6 and Python 3.7 for more information on what's supported in the latest version.

→ Automate your developer tools with Code by Zapier integrations.