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 | |
with open("myobject.lq", "rb") as file: | |
my_obj = pickle.load(file) | |
# 이후 my_obj 는 일반적인 객체랑 똑같이 사용할 수 있다. |
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 | |
with open("myobject.lq", "wb") as file: | |
pickle.dump(object(), file) | |
# object() 자리에 파일로 내보내고 싶은 객체를 넣으면 된다. |
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
class Trie(object): | |
def __init__(self): | |
self.head = Node(None) | |
""" | |
트라이에 문자열을 삽입합니다. | |
""" | |
def insert(self, string): | |
curr_node = self.head | |
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
class Node(object): | |
""" | |
A node that consists of a trie. | |
""" | |
def __init__(self, key, data=None): | |
self.key = key | |
self.data = data | |
self.children = {} |
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
class Node(object): | |
""" | |
A single node of a trie. | |
Children of nodes are defined in a dictionary | |
where each (key, value) pair is in the form of | |
(Node.key, Node() object). | |
""" | |
def __init__(self, key, data=None): | |
self.key = key |
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
# Jupyter Notebook에서 실행하세요 | |
from IPython.display import Image, display | |
from bs4 import BeautifulSoup | |
import requests | |
print("어서오세요 품격과 전통의 판교 현백입니다.\n 어떤 물건을 찾으세요?") | |
query = input() # 유저 인풋 받아오기 |
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
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*-] | |
sample_text = "신은 다시 일어서는 법을 가르치기 위해 넘어뜨린다고 나는 믿는다." | |
def word_ngram(sentence, num_gram): | |
ngrams = [] | |
text = list(sentence) # split the sentence into an array of characters | |
ngrams = [text[x:x+num_gram] for x in range(0, len(text))] |
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
public class SortingTest { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
int[] alist = {54,26,93,17,77,31,44,55,20}; | |
printArray(alist); | |
//selectionSort(alist); | |
//insertionSort(alist); |