About

Hi! I hope you are very well and have found Coding Croc useful!

About Coding Croc?

I work as a (primarily python) developer and every time I run into a piece of code that I need as a snippet, (or a bug / process that have had to solve), I’ve been adding it as a post on codingcroc. I specifically designed it so it's easy to search and copy Snippets - Like This!

a_list = ["icecream","lemon cake","chocolate cake"]

for index, value in enumerate(a_list):
    print(index, index)

Background


You might be thinking, with so many forums and resources out there like Stack Overflow, why would there be a need for another coding resource? Well, I am a heavy user + fan of all those forums :) and what I’ve found is that sometimes I just need a code snippet that's formatted in a specific way that I can re-use and literally copy and paste with little modification. Sometimes such snippets can be found - but it can be hit and miss, with some googling. Also sometimes the snippet is buried in a wall of text. And sometimes I need a couple of variations of the same snippet to choose from. 

Codingcroc posts / snippets are quite varied - sometimes they are tricky issues and workarounds, but other times they are simple things like a snippet for selenium webdriver that is laborious to manually type over and over again, or which requires extra steps to modify after copying from the official docs. 

A good example is getting a snippet for dict.reader in python. I can’t tell you how many times I’ve googled “dict.reader python”, scrolled down to https://docs.python.org/3/library/csv.html in search results, copied the snippet, then manually removed the “>>>” and “...”’s.



So I created a snippet on coding croc to make life easy :D

import csv

with open('names.csv', newline='', encoding='utf-8') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        print(
            row['first_name'],
            row['last_name']
        )

Since I use codingcroc.com myself almost everyday to save time while I work, it helps to keep the site practical and up to date.

I hope you find it useful!

COPIED

SNAPPED!

Comments

Popular posts from this blog

Append to a json file python

Setup Mailhog mail server on Ubuntu