This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add(x, y): | |
return x + y | |
def mult(x,y): | |
return x * y | |
if __name__ == "__main__": | |
import sys | |
print(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app.py content | |
setcommand = "END" | |
var1 = "AB" | |
var2 = "ZA" | |
stopcom = False | |
var_count1 = 0 | |
var_count2 = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\Desktop\py>python C:\python34\tools\scripts\2to3.py -w app.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for x in range(1, 11): | |
print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
print(sys.executable) # C:\Python34\python.EXE | |
import os | |
print(os.__file__) # C:\Python34\lib\os.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_palindrome(text): | |
return text == text[::-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |