Moved to https://github.com/jreisinger/python/blob/master/python-gurus.md
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
| #!/usr/bin/env python3 | |
| import re | |
| def max_length(strings): | |
| max_len = 0 | |
| for s in strings: | |
| if len(s) > max_len: | |
| max_len = len(s) | |
| return max_len |
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
| #!/usr/bin/python3 | |
| import os, shutil, sys | |
| topdir = "" | |
| if len(sys.argv) > 1: | |
| topdir = sys.argv[1] | |
| else: | |
| print("Usage:", sys.argv[0], "DIR") |
People
:bowtie: |
๐ :smile: |
๐ :laughing: |
|---|---|---|
๐ :blush: |
๐ :smiley: |
:relaxed: |
๐ :smirk: |
๐ :heart_eyes: |
๐ :kissing_heart: |
๐ :kissing_closed_eyes: |
๐ณ :flushed: |
๐ :relieved: |
๐ :satisfied: |
๐ :grin: |
๐ :wink: |
๐ :stuck_out_tongue_winking_eye: |
๐ :stuck_out_tongue_closed_eyes: |
๐ :grinning: |
๐ :kissing: |
๐ :kissing_smiling_eyes: |
๐ :stuck_out_tongue: |
๐ญ ๐ โ๏ธ ๐ ๐ ๐ฑ ๐ฎ ๐ ๐ ๐จ
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
| #!/usr/bin/env python3 | |
| """ Print line number and line from /etc/passwd with the given UID. | |
| """ | |
| ########## | |
| UID = 1000 | |
| ########## | |
| import fileinput, sys |
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
| #!/usr/bin/env python3 | |
| import subprocess | |
| import collections | |
| import pprint | |
| data = collections.defaultdict(list) | |
| # Ge list of files and directories | |
| lines = subprocess.check_output(['ls', '-la']).decode('utf-8').split('\n') |
pyenv - mutliple pythons
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
# maybe put this in your ~/.bashrc...
export PATH="/home/reisinge/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"