https://github.com/specht/copypasta
A for loop for text files of any kind.
https://github.com/specht/copypasta
Last synced: about 1 year ago
JSON representation
A for loop for text files of any kind.
- Host: GitHub
- URL: https://github.com/specht/copypasta
- Owner: specht
- Created: 2011-09-14T07:11:41.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-09-21T09:12:04.000Z (over 14 years ago)
- Last Synced: 2025-02-16T07:41:25.151Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 97.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.textile
Awesome Lists containing this project
README
h1. This is copypasta
Copypasta is a straightforward way to implement for loops in text files. For example,
#{for i in range(5)}
#{i + 1}, check!
#{end}
becomes:
1, check!
2, check!
3, check!
4, check!
5, check!
The leading blank line results from the newline after the for block.
Call with:
$ ./copypasta.py test-range.txt.cp
h2. Syntax
You can start a for loop with @for [key] in [values]@ where values should be something which is iterable in Python, such as a list or a range. Every @for@ statement must be matched with an @end@ statement.