/python-snippets

Python syntax examples.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

python-snippets

Snippets of python code to showcase examples of certain concepts.


Directories

  • unit-tests -> Unit test examples

Files

  • home_path.py -> Display current user's home path
  • flask_systems_list.py -> Simple Flask app using restful API endpoints
  • key_value_config.py -> Use keys and values from config files
  • list_dictionaries_with_list.py -> Nested list,dict,list data structure example
  • logging_example.py -> Using syslog functionality in Python scripts
  • print_file_pythonic.py -> Print a file line by line with automatic closing
  • print_status_msg.py -> Display status messages via print buffer flush
  • random_character_test.py -> Generate random characters for a string
  • requests_xkcd.py -> Using the requests module to retrieve website data
  • sockets_client.py -> Basic socket client, connects to server
  • sockets_server.py -> Basic socket server, accepts client connections
  • string_matching.py -> Different ways to match/search strings
  • template.py -> Template for Python scripting. Main function and argparse.
  • try_except.py -> Show try,except,finally examples
  • word_count.py -> Count occurences of words in a list