This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import cycle | |
#### I wrote this to use with flask to have a state-aware backend storage | |
#### Turns out flask already has this: http://flask.pocoo.org/docs/0.12/appcontext/ | |
class o(dict): | |
hi='' | |
def __init__(self, env): | |
self.env = env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## selfie.py | |
## Quick illustration of the 'self' keyword | |
## Illustration of `if __name__ == '__main__'` | |
## | |
## | |
## Read through the below code and comments, then try the following commands | |
## python3 selfie.py # see everything that is printed to screen | |
## python3 # see that the code outside the class and the __name__ if condition is run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
[ | |
{ | |
"r": 5, | |
"y": -1.5, | |
"x": 19.25 | |
}, | |
"PrtSc", | |
"Scroll Lock", | |
"Pause\nBreak" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import yaml | |
# sample usage: | |
# user@shell$ python3 yams_test.py file1.yaml file2.yaml file3.yaml | |
print(sys.argv) | |
for fname in sys.argv[1:]: | |
fin = open(fname, 'r') |