For the Mac:
brew tap homebrew/science
brew install opencv
Get a codec for saving video:
brew install ffmpeg
Summary:
import os | |
def unicode_open(filename, *args, **kwargs): | |
""" | |
Opens a file as usual on Python 3, and with UTF-8 encoding on Python 2. | |
:param filename: Name of file to open. | |
""" | |
filename = fix_path(filename) | |
kwargs['encoding'] = "utf-8" |
For the Mac:
brew tap homebrew/science
brew install opencv
Get a codec for saving video:
brew install ffmpeg
Summary:
"""When run, this generates the following error: | |
Traceback (most recent call last): | |
File "what_me_asynicio.py", line 14, in <module> | |
loop.create_task(factorial("A", 2)), | |
AttributeError: '_UnixSelectorEventLoop' object has no attribute 'create_task' | |
Code Source: https://docs.python.org/3/library/asyncio-task.html#example-parallel-execution-of-tasks | |
Python Version: 3.4.1 | |
Operating System: OSX 10.9.3 | |
Resuls of dir() on `loop = asyncio.get_event_loop()`: |
Hello, | |
We are conducting research on the unintended exposure of secrets in GitHub repositories. | |
In a recent scan we conducted of GitHub repositories, our tool detected that one of your | |
repositories appears to expose a secret, and we've confirmed this possibility by manual | |
inspection. The details are below: | |
# Branch: master | |
## File: ****/****/settings/dev.py | |
## Line: 20 |
class cached_property(object): | |
"""A property that is only computed once per instance and then replaces | |
itself with an ordinary attribute. Deleting the attribute resets the | |
property.""" | |
def __init__(self, func): | |
self.__doc__ = getattr(func, '__doc__') | |
self.func = func | |
def __get__(self, obj, cls): |
<h2>{{ city.name }} ({{ city.steak_places|length }})</h2> | |
<ol> | |
{% for p in city.steak_places %} | |
<li>{{ p.name }}</li> | |
{% endfor %} | |
</ol> |
>>> class Hello(object): | |
... @cached_property | |
... def audreyr(self): | |
... print('Audrey Roy Greenfeld called') | |
... return 1 | |
>>> o = Hello() | |
>>> v = o.audreyr | |
'Audrey Roy Greenfeld called' | |
>>> print(v) | |
1 |
def ager(age): | |
for i in range(1, age + 1): | |
if age % i == 0: | |
print(i) | |
ager(47) |
import csv | |
with open("export.csv") as f: | |
for row in csv.DictReader(f): | |
print(row['name']) | |
print(row['teeth']) |