Skip to content

Instantly share code, notes, and snippets.

View neoneo40's full-sized avatar

neo neoneo40

  • Seoul, Korea
View GitHub Profile
import os
import docx
from docx.document import Document
from docx.oxml.table import CT_Tbl
from docx.oxml.text.paragraph import CT_P
from docx.table import _Cell, Table
from docx.text.paragraph import Paragraph
os.chdir('C:\\OJT_Kevin\\161027_docx_parsing')
from .models import Url
def get_columns(line):
column_str = re.search(r'COPY [-_\w\.]+ \(([^\)]+)\)', line).group(1)
columns = column_str.split(',')
return [column.strip() for column in columns]
def is_start(text):
from .models import Url
def get_columns(line):
column_str = re.search(r'COPY [-_\w\.]+ \(([^\)]+)\)', line).group(1)
columns = column_str.split(',')
return [column.strip() for column in columns]
def is_start(text):
@neoneo40
neoneo40 / psql_ignore_errors.md
Last active September 7, 2018 16:51
psql ignore errors

psql ignore errors

  • 이미 존재하는 DB에 psql로 데이터를 넣다보면 Integrity Error 가 발생할 떄가 있다. 근데 psql 옵션에는 각 한줄 한줄의 error를 무시할 수 있는 옵션이 없다.
  • 그냥 바로 넣기 때문인데... 이것 때문에 짜증이 나서 파이썬으로 한줄씩 읽으면서 DB에 넣고 Error가 발생하면 그 Data는 무시할 수 있게끔 했다.
  • 끝까지 넣기만 하면 되는거다. Data 정합성이 중요하다면 이렇게 하면 안되지만 정합성이 중요하지 않은 Data들에서는 충분히 쓸만한 소스다.
@neoneo40
neoneo40 / django_101.md
Last active January 12, 2019 05:25
Django 기초 배우기

Django 기초 배우기

강의 자료들

@neoneo40
neoneo40 / how_to_extract_exact_url.md
Last active September 20, 2020 06:50
앞에 url만 추출할 수 있는 방법