Skip to content

Instantly share code, notes, and snippets.

View ejmurray's full-sized avatar

Ernest Murray ejmurray

  • Leeds, UK
  • 21:33 (UTC -12:00)
View GitHub Profile
This is stuff that I've typed into a file.
It's really cool stuff.
Lots and lots of fun to have in here.
#!/bin/python3
# For this example, when you repeat it for the second time in the console, you need
# to put the name of the file in quotes "" so it sees it as a string.
# http://goo.gl/JiVv8q
# TODO comment each line in this script
__author__ = 'Ernest'
from sys import argv
#!/bin/python3
# __author__ = 'Ernest'
#
# # Prompting and Passing
#
# from sys import argv
#
# script, user_name = argv
# prompt = '> '
#
__author__ = 'Ernest'
# http://goo.gl/TTWavf this tutorial on the mouse vs python
# http://goo.gl/bmovjk python 3 urllib import
# C:\Users\ernest\Downloads\blog.pythonlibrary.org-Using pyGal Graphs in Flask.pdf
# API 0d334d714fe6b157
import pygal
import json
import requests
__author__ = 'Ernest'
# http://goo.gl/Yksyj8
import os
directory = 'D:\\Dropbox\\www\\boilerplates\\testdir'
find = "foobar"
replace = "foobar"
# walk through the directory from bottom up
@ejmurray
ejmurray / fizzBuzz.py
Created April 12, 2015 12:36
fizzBuzz.py
i = 0
for i in range (1, 101):
if i % 3 == 0 and i % 5 == 0:
print "FIZZ BUZZ"
elif i % 3 == 0:
print "FIZZ"
elif i % 5 == 0:
print "BUZZ"
else:
@ejmurray
ejmurray / chapter3_lists1.py
Created April 10, 2015 16:10
playing with lists from Introducing Python
__author__ = 'Ernest'
# create a list with [] or ()
empty_list = []
weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
# convert the data types to a list
list('cats')
a_tuple = ['ready', 'fire', 'aim']
#!/usr/bin/python
# encoding: utf-8
"""
Created: 08/04/15, 12:32
Description:
"""
import os
# The top argument for walking a directory
topdir = '.'
__author__ = 'Ernest'
# Material from chapter 2 of Introduction to python
# to save a session from the console in ipython use the following
# command - %save my_session 1-20
# where %save is teh save command, my_session is the file name
# and 1-20 are the lines that you want to save.
# this data has been added to github as a new repo
# and this line
letters = 'abcdefghijklmnopqrstuvwxyz'
# coding: utf-8
letters = 'abcdefghijklmnopqrstuvwxyz'
letters[:]
letters[20:]
letters[10:]
letters[12:15]
letters[-3:]
letters[18:-3]
letters[-6:-2]
letters[::7]