n8n-code-python

Process Python data in n8n Code nodes using the standard library.

Updated Mar 11, 2026
One-click install
npx skills add https://github.com/automate-me7/agent-skills --skill n8n-code-python-automate-me7
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/automate-me7/agent-skills/tree/main/n8n-code-python
Command: npx skills add https://github.com/automate-me7/agent-skills --skill n8n-code-python-automate-me7

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps developers write Python code inside n8n Code nodes, clarifying the no external libraries constraint and safe data-handling patterns to prevent errors.

Core Features & Use Cases

  • Safe data access using _input.all(), _input.first(), _input.item, and correct Webhook body handling.
  • Production-ready data transformation and validation using Python's standard library (json, datetime, re, base64, hashlib, etc.).
  • Clear guidance on when to use Python vs JavaScript in n8n and how to structure Code node outputs.

Quick Start

Create a minimal Python Code node that reads from _input.all() and returns a properly formatted item with a json field to verify setup.

Frequently Asked Questions about n8n-code-python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Python in n8n Code nodes without errors?▼

To write Python in n8n Code nodes safely, access data using _input.all() or _input.first(), handle webhook payloads carefully, and always return a list of objects containing a json key, such as return [{"json": {}}].

Can I use external Python libraries inside n8n Code nodes?▼

No, you cannot use external Python libraries inside n8n Code nodes. Python data processing is restricted to the standard library only, utilizing built-in modules like json, datetime, re, base64, and hashlib for transformations.

What is the correct return format for Python data transformation in n8n?▼

The correct return format for Python data transformation in n8n is a list of objects where each object contains a json key. You must structure your output as return [{"json": {}}] to prevent workflow execution errors.

When should I use Python vs JavaScript for data processing in n8n?▼

You should use Python in n8n when you need standard library modules like datetime, re, or hashlib for data validation and transformation. Use JavaScript for node-specific operations or when external npm packages are required.

How do I handle webhook payloads in n8n Python Code nodes?▼

To handle webhook payloads in n8n Python Code nodes, apply safe data access patterns using _input.first() or _input.all(). This ensures the incoming webhook body is parsed correctly before applying standard library transformations.

Does n8n support per-item processing with Python standard library functions?▼

Yes, n8n supports per-item processing using Python standard library functions. You can access individual items via _input.item, apply validation using modules like json or re, and return the transformed data in the required json key format.