A console/terminal demo of string quoting in Python: single quotes, an escaped apostrophe inside single quotes, double quotes, a backslash at the end of a line to continue a long string, and triple-quoted strings that span several lines. Runs on Windows 11 and Ubuntu Linux 24.04, uses the standard library only — no third-party packages, no GPU, fully offline.
[Folder Structure]
- CLAUDE.md / AGENT.md: program specification (identical content).
- CHANGELOG.md: change log.
- copyright.txt: copyright notice.
- src/: the example, the launcher scripts, and this document.
- venv/: Python virtual environment, created by step 1.
[Prerequisites]
- Operating system: Windows 11 or Ubuntu Linux 24.04.
- Python 3 and pip.
- No third-party packages — the example uses the standard library only.
- No internet connection and no GPU required.
[Instructions]
Step 1: Create the virtual environment
Create the virtual environment. Because the example uses only the standard library, this step installs no extra packages.
Windows 11:
src\01_venv_create.bat
Ubuntu Linux 24.04:
bash src/01_venv_create.sh
Step 2: Activate the virtual environment
Activate the environment in the current shell. On Linux you must source the script so the activation stays in effect after it finishes.
Windows 11:
src\02_venv_activate.bat
Ubuntu Linux 24.04:
source src/02_venv_activate.sh
Step 3: Run the quoting demo
Run the demo. It prints a string in single quotes, one containing an escaped apostrophe, one in double quotes, a long string broken across source lines with a trailing backslash, and a triple-quoted string that keeps its own line breaks — so you can see what each form produces.
Windows 11:
src\03_quote.bat
Ubuntu Linux 24.04:
bash src/03_quote.sh
Step 4: Remove the virtual environment
When you are finished, delete the venv/ folder to free up disk space. Re-run step 1 whenever you need the environment again.
Windows 11:
src\99_venv_clear.bat
Ubuntu Linux 24.04:
bash src/99_venv_clear.sh
[Usage Notes]
- Single and double quotes are interchangeable in Python. Pick the one that is not inside the text and you need no escaping at all: a sentence containing an apostrophe is easiest in double quotes.
- A backslash escapes the next character, so it is the way to put a quote of the same kind inside a string — and to write a literal backslash you double it.
- A backslash at the very end of a source line continues the string on the next line without adding a line break to its value; it only makes the source easier to read.
- Triple quotes keep every line break and space exactly as typed, which is why they suit multi-line text and are also used for docstrings.
This SDK is built in AppForAI - AI Dev Tools.
Purchase license separately: USD 600, permanent authorization, single APP authorization, single machine authorization, one-year activation, one-year download, one-year update, one-year email technical support.