This file contains hidden or 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
| from pyPdf import PdfFileWriter, PdfFileReader | |
| output = PdfFileWriter() | |
| input1 = PdfFileReader(file("1.pdf", "rb")) | |
| input2 = PdfFileReader(file("2.pdf", "rb")) | |
| input3 = PdfFileReader(file("3.pdf", "rb")) | |
| input4 = PdfFileReader(file("4.pdf", "rb")) | |
| inputs = [] | |
| inputs.append(input1) |
This file contains hidden or 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
| from pyPdf import PdfFileWriter, PdfFileReader | |
| output = PdfFileWriter() | |
| input1 = PdfFileReader(file("hardcopy1.pdf", "rb")) | |
| input2 = PdfFileReader(file("hardcopy2.pdf", "rb")) | |
| input3 = PdfFileReader(file("hardcopy3.pdf", "rb")) | |
| inputs = [] | |
| inputs.append(input1) | |
| inputs.append(input2) |
This file contains hidden or 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
| # coding=utf-8 | |
| import csv | |
| template = 'Person(name=u"%(姓名)s", birthday="%(生年月日)s", sex=u"%(性別)s").save()' | |
| data = csv.reader(open('data.csv')) | |
| # ヘッダー行を飛ばす | |
| header = data.next() |
This file contains hidden or 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
| # coding: utf-8 | |
| # http://kimihiro-n.appspot.com/show/5814395191951360 | |
| import csv, json | |
| print([json.dumps(l) for l in csv.DictReader(open('hoge.csv'))]) |
This file contains hidden or 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://kimihiro-n.appspot.com/show/5814395191951360 | |
| import csv | |
| import json | |
| result = [] | |
| with open('hoge.csv') as f: | |
| for line in csv.DictReader(f): | |
| line_json = json.dumps(line) | |
| result.append(line_json) |
This file contains hidden or 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://qiita.com/ktyubeshi/items/74228f18498224c7427d | |
| Option Explicit | |
| Public Function REGEXP(文字列 As String, 正規表現文字列 As String, Optional SubMatchIndex As Integer = -1) | |
| 'Dim RE As VBScript_RegExp_55.REGEXP | |
| 'Dim ReMatch As MatchCollection | |
| 'Dim M As Match |
This file contains hidden or 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://a-zumi.net/python-singleton/ | |
| class Singleton(object): | |
| __instance = None | |
| # __new__は__init__の前に実行されるのでここでインスタンスが生成されているか確認する | |
| def __new__(cls, *args, **kwargs): | |
| if cls.__instance is None: | |
| cls.__instance = object.__new__(cls) | |
| return cls.__instance | |
This file contains hidden or 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
| MyClass = type( | |
| 'MyClass', | |
| (object), | |
| { | |
| '__init__': lambda self, val: setattr(self, '_val', val), | |
| 'say': lambda self: self._val, | |
| }, | |
| ) |
This file contains hidden or 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
| #https://sites.google.com/site/hoseifujii/news/pythonniyorumugouzaonozaiguidingyiniyorushizhuang | |
| import random as r | |
| namelist=['apple','grape','orange','lemon','banana'] | |
| class node: | |
| def __init__(self, name, children): | |
| self.name = name # String | |
| self.children = children # List of Class node |
This file contains hidden or 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 split_list(list, n): | |
| if not list: | |
| return [] | |
| return [list[:n]] + split_list(list[n:], n) |
OlderNewer