Skip to content

Instantly share code, notes, and snippets.

View bazuzu931's full-sized avatar
💭
you're tearing me apart lisa!

bazuzu931 bazuzu931

💭
you're tearing me apart lisa!
View GitHub Profile
@bazuzu931
bazuzu931 / sys_arg_example_1.py
Last active February 10, 2017 14:24
sys_arg_example_1.py
def add(x, y):
return x + y
def mult(x,y):
return x * y
if __name__ == "__main__":
import sys
print(sys.argv)
/* http://meyerweb.com/eric/tools/css/reset/ */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
@bazuzu931
bazuzu931 / using_CL_with.py
Last active February 10, 2017 14:25
using_CL_with.py
# app.py content
setcommand = "END"
var1 = "AB"
var2 = "ZA"
stopcom = False
var_count1 = 0
var_count2 = 0
@bazuzu931
bazuzu931 / csv_example_1.py
Last active February 10, 2017 14:25
csv_example_1.py
# we have 2 csv file. Sorted them by name - row[1] and get difference
import csv
import pprint
def sort_csv_table(file):
f = open(file)
f_csv = csv.reader(f, delimiter=',')
table = []
@bazuzu931
bazuzu931 / convert_py2_to_py3.py
Last active February 10, 2017 14:20
convert_py2_to_py3.py
\Desktop\py>python C:\python34\tools\scripts\2to3.py -w app.py
@bazuzu931
bazuzu931 / correct_column_build.py
Last active February 10, 2017 14:26
correct_column_build.py
for x in range(1, 11):
print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))
@bazuzu931
bazuzu931 / to_figure_file.png-jpeg-or-any_bytes.py
Last active February 10, 2017 14:21
to_figure_file.png-jpeg-or-any_bytes.py
import io
with open('pikachu.png', 'rb') as pngfile:
pngdata = pngfile.read()
if pngdata.startswith(b'\x89'):
text = "it's pngfile (%d bytes)"
else:
text = "it's common file (%d bytes)"
@bazuzu931
bazuzu931 / path_to_Py_lib_and_Py_interpreter.py
Last active February 10, 2017 14:20
path_to_Py_lib_and_Py_interpreter.py
import sys
print(sys.executable) # C:\Python34\python.EXE
import os
print(os.__file__) # C:\Python34\lib\os.py
def is_palindrome(text):
return text == text[::-1]
import pickle
data = ['asus', 'hp', 'acer']
with open('objectFile.txt', 'wb') as file:
pickle.dump(data, file)
del(data)
with open('objectFile.txt', 'rb') as file: