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
lst = list(range(16)) | |
#lst = IN[0] | |
print lst | |
out = [] | |
for idx, x in enumerate(lst): | |
if idx > 0: | |
out.append([lst[idx - 1], x]) | |
OUT = out | |
print OUT |
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
var5 = [["A","B","C"],["D"],["E","F","H"],["I"],["A","B","C"],["D","G"],["E","F","H"],["I"],["E","F","H"],["I"],["A","B","C"],["D"],["E","F"],["I"],["D"],["E","F","H"],["I"],["A","B","C"],["E","F","H"],["I"]] | |
iterable = iter(var5) | |
flag = True | |
out = [] | |
while flag: | |
try: | |
sublst = next(iterable) | |
if len(sublst) > 1: | |
out.append(sublst) |
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
var2 = ['a','b','b','c','d','e', 'g', 'a', 'b','c', 'a','b','c','e'] | |
def splitChar2(lst): | |
temp = [] | |
for idx, x in enumerate(lst): | |
try: | |
if lst[idx + 1] != 'a': | |
temp.append(x) | |
else: | |
temp.append(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
var = ['a','b','c','b','c', 'd', 'e', 'a','b', 'a','b','c'] | |
def splitChar(lst): | |
temp = [] | |
for idx, x in enumerate(lst): | |
try: | |
if ord(x) + 1 == ord(lst[idx + 1]): | |
temp.append(x) | |
else: | |
temp.append(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 re | |
varstr = "Python c) like pip to install" | |
regEx = r'(\w\)\s\w+)\s?' | |
#mid = re.search(regEx, varstr).group(1) | |
newlst = re.split(regEx, varstr) | |
print newlst |
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
lstvar = ["A","B","C","","","D","F","","G","","",""] | |
newlst =[] | |
for x in lstvar: | |
if x != "": | |
newlst.append(x) | |
else: | |
newlst.append(newlst[-1]) | |
print newlst |
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
lstvar = ["A","B","C","","","D","F","","G","","",""] | |
newlst =[] | |
for x in lstvar: | |
if x != "": | |
newlst.append(x) | |
else: | |
newlst.append(newlst[-1]) | |
print newlst |
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 | |
from . import music_importer | |
sys.meta_path.append(music_importer.MusicImporter) | |
# このモジュールでimport sysされているため、必ずsys.modulesにsysはある | |
sys.modules['sys'] = sys |
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 System | |
import sys | |
pf_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFilesX86) | |
sys.path.append('%s\IronPython 2.7\Lib' % pf_path) | |
from cStringIO import StringIO | |
sys.stdout = StringIO() | |
alphabet = [chr(i) for i in range(ord('a'),ord('z')+1)] | |
def funtest(): | |
global dict |
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 os | |
import os.path as op | |
import olefile | |
import re | |
def getfileInfo(bfi): | |
msgbox = 'Version non trouvée' | |
file_info_read = bfi.read() | |
for codec , regex in [['utf_16_le', r"(\d{4})..Build"], ['utf_16_be', r"Format.+?(\d{4})"]]: | |
file_info = file_info_read.decode(codec, "ignore") |