This file contains hidden or 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
| cats = input("How many cats do you have?") | |
| dogs = input("How many dogs do you have?") | |
| print("You have %r cats and %r dogs." % (cats, dogs)) | |
| print("You have %r pets in total." % (cats + dogs)) |
This file contains hidden or 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
| def number_to_name(number): | |
| return _number_to_name[number] | |
| def rpsls(player_choice): | |
| # delete the following pass statement and fill in your code below | |
| # print a blank line to separate consecutive games | |
| print "" | |
| # print out the message for the player's choice |
This file contains hidden or 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 string | |
| class Template(string.Formatter): | |
| def format_field(self, value, spec): | |
| if spec.endswith('h'): | |
| value = str(value) # ultimately, this will call a funtion that will format the value and return as string | |
| spec = spec[:-1] + 's' | |
| return super(Template, self).format_field(value, spec) | |
| f= Template() |
This file contains hidden or 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
| (let (found) | |
| (mapatoms (lambda (thing) (when (get thing 'thing-at-point) (setq found (cons (get thing 'thing-at-point) found))))) | |
| found) | |
| (thing-at-point-url-at-point number-at-point #[nil "\301\302!\211\205 \303@A\")\207" [boundary-pair bounds-of-thing-at-point email buffer-substring-no-properties] 4]) |
This file contains hidden or 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
| [app:rackcontrol] | |
| use = egg:RackControl | |
| pyramid.reload_templates = false | |
| pyramid.debug_authorization = false | |
| pyramid.debug_notfound = false | |
| pyramid.debug_routematch = false | |
| pyramid.default_locale_name = en | |
| pyramid.includes = pyramid_exclog | |
| mako.directories = rackcontrol:templates |
This file contains hidden or 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
| >>> f = subprocess.check_output(['/bin/bash', '-c', """ awk '{print $1, $2, $3}' < /proc/loadavg"""]).rstrip() | |
| >>> f | |
| '0.00 0.01 0.05' | |
| >>> |
This file contains hidden or 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
| batch = [] | |
| for line in sys.stdin: | |
| if len(batch) == 100: | |
| do_something_with_batch(batch) | |
| batch = [] | |
| batch.append(line) |
This file contains hidden or 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
| batch = [] | |
| for line in sys.stdin: | |
| if len(batch) == 100: | |
| do_something_with_batch(batch) | |
| batch = [] | |
| batch.append(line) |
This file contains hidden or 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
| batch = [] | |
| for line in sys.stdin: | |
| if len(batch) == 100: | |
| do_something_with_batch(batch) | |
| batch = [] | |
| batch.append(line) |
This file contains hidden or 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
| batch = [] | |
| for line in sys.stdin: | |
| if len(batch) == 100: | |
| do_something_with_batch(batch) | |
| batch = [] | |
| batch.append(line) |