diff --git a/Silocean/0000/DejaVuSansMono.ttf b/Silocean/0000/DejaVuSansMono.ttf new file mode 100644 index 00000000..9bebb47e Binary files /dev/null and b/Silocean/0000/DejaVuSansMono.ttf differ diff --git a/Silocean/0000/Test.py b/Silocean/0000/Test.py new file mode 100644 index 00000000..d1b6c689 --- /dev/null +++ b/Silocean/0000/Test.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +""" +Created on Fri Jun 5 13:40:53 2015 + +@author: Tracy +""" + +from PIL import Image +from PIL import ImageDraw +from PIL import ImageFont + +img = Image.open('icon.jpg') +draw = ImageDraw.Draw(img) +font = ImageFont.truetype('DejaVuSansMono.ttf',100) + +draw.text((img.size[0]-100,30),"3",(255,0,0), font) + +img.save('result.jpg') diff --git a/Silocean/0004/Test.py b/Silocean/0004/Test.py new file mode 100644 index 00000000..4955b1b9 --- /dev/null +++ b/Silocean/0004/Test.py @@ -0,0 +1,12 @@ +__author__ = 'Tracy' + +import io, re + +count = 0 + +with io.open('text.txt', 'r') as file: + for line in file.readlines(): + list = re.findall("[a-zA-Z]+'*-*[a-zA-Z]*", line) + count += len(list) +print(count) + diff --git a/Silocean/0004/text.txt b/Silocean/0004/text.txt new file mode 100644 index 00000000..2379c58b --- /dev/null +++ b/Silocean/0004/text.txt @@ -0,0 +1 @@ +The Dursleys had everything they wanted, but they also had a secret, and their greatest fear was that somebody would discover it. They didn't think they could bear it if anyone found out about the Potters. Mrs. Potter was Mrs. Dursley's sister, but they hadn't met for several years; in fact, Mrs. Dursley pretended she didn't have a sister, because her sister and her good-for-nothing husband were as unDursleyish as it was possible to be. The Dursleys shuddered to think what the neighbors would say if the Potters arrived in the street. The Dursleys knew that the Potters had a small son, too, but they had never even seen him. This boy was another good reason for keeping the Potters away; they didn't want Dudley mixing with a child like that. \ No newline at end of file diff --git a/Silocean/0007/Test.py b/Silocean/0007/Test.py new file mode 100644 index 00000000..7c09b4db --- /dev/null +++ b/Silocean/0007/Test.py @@ -0,0 +1,39 @@ +__author__ = 'Tracy' + +import os, io, re + +commentLines = 0 +whiteLines = 0 +comment = False + +path = 'F:\AllKindsOfWorkplace\PyCharmWorkplace\PythonLearning' + +count = 0 +def tree(path): + filelist = os.listdir(path) + for file in filelist: + if os.path.isdir(os.path.join(path, file)): + tree(os.path.join(path, file)) + else: + filename = os.path.basename(os.path.join(path, file)) + if filename.endswith(".py"): + # print(filename) + file = io.open(os.path.join(path, file)) + parse(file) + file.close() + +def parse(file): + global commentLines + global whiteLines + global comment + for line in file.readlines(): + # line = line.strip("\n") + if line.startswith("#"): + commentLines += 1 + elif re.match("^[\\s&&[^\\n]]*$", line): + whiteLines += 1 + +tree(path) + +print(commentLines) +print(whiteLines) diff --git a/Silocean/0008/Test.html b/Silocean/0008/Test.html new file mode 100644 index 00000000..17e2b30a --- /dev/null +++ b/Silocean/0008/Test.html @@ -0,0 +1,17 @@ + + + + +This is the Title + + + +
+ +