An open API service indexing awesome lists of open source software.

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.

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.