Skip to content

A fun little command line random picker written in python

License

Notifications You must be signed in to change notification settings

JasonBristol/pypicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pypicker

A command line random picker for python.

usage: pypicker.py [-h] [-i PATH] [-g INTEGER] [-o PATH] [-j DELIMITER] [-v]
                   [-u] [--version]
                   [SAMPLE SIZE] [SAMPLE GROUP [SAMPLE GROUP ...]]
                   
Randomly pick items from a list
 
positional arguments:
  SAMPLE SIZE    number of items to pick (default: 1)
  SAMPLE GROUP   list of items to choose from.
  
optional arguments:
  -h, --help     show this help message and exit
  -i PATH        input file of items to choose from
  -g INTEGER     number of result groups to generate (default: 1)
  -o PATH        output file to write results to
  -j DELIMITER   join results using specified delimiter
  -v, --verbose  verbose output
  -u, --unique   force uniqueness across result groups
  --version      show program's version number and exit
  
Created by Jason Bristol <json.bristol@gmail.com>

Randomly pick 2 items from a list

$ python pypicker.py 2 a b c d

c
a

Randomly pick an item from a file

$ python pypicker.py -i test_input.txt

Yolanda Holland

Randomly pick 4 groups of 4 from a list

$ python pypicker.py 4 -i test_input.txt -g 4 -v

Picking 4 item(s) out of 29:
Faith Boone
Hilda Mullins
Lewis Potter
Leona Evans

Picking 4 item(s) out of 29:
Francisco Williams
Yolanda Holland
Ellis Jennings
Danielle Gill

Picking 4 item(s) out of 29:
Jessica Mitchell
Renee Willis
Betty Lane
Yolanda Holland

Picking 4 item(s) out of 29:
Hilda Mullins
Jessica Mitchell
Boyd Hunter
Wilson Marshall

Randomly pick 4 unique groups of 4 from a list

$ python pypicker.py 4 -i test_input.txt -g -v -u

Picking 4 item(s) out of 25:
Danielle Gill
Boyd Hunter
Amos Warner
Leona Evans

Picking 4 item(s) out of 21:
Ellis Jennings
Francisco Williams
Renee Willis
Herbert Ball

Picking 4 item(s) out of 17:
Mindy Lopez
Faith Boone
Hilda Mullins
Lucille Clayton

Picking 4 item(s) out of 13:
Yolanda Holland
Trevor Goodman
Lewis Potter
Betty Lane

Write output to a file

$ python pypicker.py 4 -i test_input.txt -o test_ouptut.txt

test_output.txt

Faith Boone
Leona Evans
Boyd Hunter
Phillip Bailey

Join the results and seperate by a delimeter

$ python pypicker.py 4 -i test_input.txt -j ', '

Shirley Joseph, Brandon Rice, Ellis Jennings, Anita Larson

About

A fun little command line random picker written in python

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages