'Programming'에 해당되는 글 1762건

  1. 2020.01.11 오랫만에 한가로움?
  2. 2020.01.10 python split
  3. 2020.01.09 python 겅부
  4. 2020.01.09 python 관련 문서들
  5. 2020.01.03 css3 calc()
  6. 2020.01.02 python exception
  7. 2019.12.17 node.js xpath 그리고 boolean
  8. 2019.12.14 python 컴파일하기 및 디컴파일?
  9. 2019.12.13 python indent
  10. 2019.12.10 node.js JWT with refresh token

머 애들이랑 놀아주는게 한가로울리가 없지만

그래도 마음 편하게 가족이랑 있으니 좋긴하네

'Programming > python(파이썬)' 카테고리의 다른 글

python 반복문 for in range()  (0) 2020.01.11
python print 와 while 문  (0) 2020.01.11
python split  (0) 2020.01.10
python 겅부  (0) 2020.01.09
python 관련 문서들  (0) 2020.01.09
Posted by 구차니

파싱을 위해 split 함수 혹은 tokenizer를 찾고 있는 중.

(regexp_split 같은 것도 있으려나?)

 

[링크 : https://wayhome25.github.io/python/2017/02/26/py-14-list/]

[링크 : https://wikidocs.net/13]

[링크 : https://www.w3schools.com/python/ref_string_split.asp]

[링크 : https://mainia.tistory.com/5624]

 

+

[링크 : https://stackoverflow.com/questions/13209288/python-split-string-based-on-regex]

'Programming > python(파이썬)' 카테고리의 다른 글

python print 와 while 문  (0) 2020.01.11
오랫만에 한가로움?  (0) 2020.01.11
python 겅부  (0) 2020.01.09
python 관련 문서들  (0) 2020.01.09
python exception  (0) 2020.01.02
Posted by 구차니

 

$ python3
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

5.4.5. 문자열 포맷팅
>>> age = 20
>>> name = 'Swaroop'
>>> print ("{0} was {1} years old".format(name, age))
Swaroop was 20 years old
>>> print ("{1} was {0} years old".format(name, age))
20 was Swaroop years old
>>> print ("{1:.3f} was {0} years old".format(name, age))
20.000 was Swaroop years old

5.4.7 순 문자열
>>> print(r"\a")
\a
>>> print("\a")

'Programming > python(파이썬)' 카테고리의 다른 글

오랫만에 한가로움?  (0) 2020.01.11
python split  (0) 2020.01.10
python 관련 문서들  (0) 2020.01.09
python exception  (0) 2020.01.02
python 컴파일하기 및 디컴파일?  (0) 2019.12.14
Posted by 구차니

이제 다시 한번 마스터 해봐야지..

node.js 해서 문법적으로 유사성을 찾으면 좀 쉬우려나?

 

[링크 : https://docs.python.org/3.8/download.html]

[링크 : http://byteofpython-korean.sourceforge.net/byte_of_python.pdf] 2.7 기준

'Programming > python(파이썬)' 카테고리의 다른 글

python split  (0) 2020.01.10
python 겅부  (0) 2020.01.09
python exception  (0) 2020.01.02
python 컴파일하기 및 디컴파일?  (0) 2019.12.14
python indent  (0) 2019.12.13
Posted by 구차니
Programming/css2020. 1. 3. 16:14

css에서 연산을 할 수 있게 한다는 것은 양날의 검이 될 듯 한데..

아무튼 이런 기능이 있다는걸 오늘 처음 알았음.

 

[링크 : https://developer.mozilla.org/ko/docs/Web/CSS/calc]

[링크 : https://www.codingfactory.net/10373]

[링크 : https://techbug.tistory.com/215]

'Programming > css' 카테고리의 다른 글

css 반응형 웹 대응 - 미디어 쿼리  (0) 2024.01.18
@keyframe in css  (0) 2019.01.29
css transform zindex origin  (0) 2018.10.25
css tooltip 위치  (0) 2018.10.25
css로 백그라운드만 돌리기  (0) 2018.10.10
Posted by 구차니

C만 쓰다 보니 예외처리 부터 공부를 좀 해야겠다..

Cpp만 써봤어도 이해가 쉬울텐데...

 

[링크 : https://docs.python.org/ko/3/tutorial/errors.html]

[링크 : https://wikidocs.net/30]

'Programming > python(파이썬)' 카테고리의 다른 글

python 겅부  (0) 2020.01.09
python 관련 문서들  (0) 2020.01.09
python 컴파일하기 및 디컴파일?  (0) 2019.12.14
python indent  (0) 2019.12.13
tensorflow, pytorch  (0) 2019.12.10
Posted by 구차니
Programming/node.js2019. 12. 17. 13:26

이제야 눈에 띄는 DOM3 XPath 1.0 implementation..

그래서 문법을 많이 적용 못 받은건가? 최신은 3.1인 것 같은데 1.0이라서 기능들이 많이 빠진듯

 

DOM 3 XPath 1.0 implemention and helper for JavaScript, with node.js support.

[링크 : https://www.npmjs.com/package/xpath]

 

아무튼 boolean() 함수는 결과값이 boolean 타입이다(당연하지만)

[링크 : https://developer.mozilla.org/ko/docs/Web/XPath/Functions/boolean]

 

아래는 xpath node.js npm의 예제를 이용하여

/book 노드가 실제로 존재하는지 boolean()으로 체크하도록 수정한 내용이다.

> var xpath = require('xpath')
undefined
>
> var dom = require('xmldom').DOMParser
undefined
> var xml = ""
undefined
> var doc = new dom().parseFromString(xml)
undefined
console.log(xml)

undefined
> var nodes = xpath.select("//title", doc)
undefined
console.log(nodes[0].localName + ": " + nodes[0].firstChild.data)
title: Harry Potter
undefined
var test = xpath.select("boolean(/book)", doc)
undefined
console.log(typeof test)
boolean
undefined
console.log(test)
true

typeof로 체크시 boolean 타입으로 나오니.. 기존에 프로그램을 좀 수정해야 할 듯..

'Programming > node.js' 카테고리의 다른 글

node.js cookie 관련 함수들  (0) 2020.01.19
node.js crypto 모듈  (0) 2020.01.19
node.js JWT with refresh token  (0) 2019.12.10
node.js synchornous file write  (0) 2019.11.06
postgres on node.js  (0) 2019.09.24
Posted by 구차니

심심해서 잠도 안오겠다 -_-

python 가지고 놀다가 신기한 것 발견(?)

 

1. python2.x와 python3.x의 pyc 경로는 다르다.

2. python2.x와 python3.x의 pyc는 호환되지 않는다.

 

환경은 우분투 18.04 LTS. 설치된 버전정보는 다음과 같고

$ python --version
Python 2.7.15+

$ python3 --version
Python 3.6.9

 

python -m compileall . 과

python3 -m compileall . 의 결과는 아래와 같이

python(2.7.15)는 동일 경로상에 pyc로 생성되는데 반해

python3(3.6.9)는 __pycache__ 디렉토리 아래에 cpython 버전 정보를 기재하면서 pyc로 생성하게 된다.

.:
합계 20
drwxr-xr-x 3 minimonk minimonk 4096 12월 14 23:43 ./
drwxr-xr-x 5 minimonk minimonk 4096 12월 13 21:51 ../
drwxr-xr-x 2 minimonk minimonk 4096 12월 14 23:44 __pycache__/
-rw-r--r-- 1 minimonk minimonk   42 12월 14 23:43 test.py
-rw-r--r-- 1 minimonk minimonk  145 12월 14 23:43 test.pyc

./__pycache__:
합계 12
drwxr-xr-x 2 minimonk minimonk 4096 12월 14 23:44 ./
drwxr-xr-x 3 minimonk minimonk 4096 12월 14 23:43 ../
-rw-r--r-- 1 minimonk minimonk  140 12월 14 23:43 test.cpython-36.pyc

 

그리고 file 정보를 보면 pyc도 2.7대와 3.6대 byte-compiled로 나뉘게 되는데

$ file *
__pycache__: directory
test.py:     ASCII text
test.pyc:    python 2.7 byte-compiled

 

$ file __pycache__/*
__pycache__/test.cpython-36.pyc: python 3.6 byte-compiled

 

python2.7의 pyc를 python2.7과 python3.6으로 실행하면

python3.6 버전으로는 2.7의 pyc를 실행할 수 없다면서 에러를 발생시킨다.

$ python test.pyc
hello world
aa

$ python3 test.pyc
RuntimeError: Bad magic number in .pyc file

 

반대로  python3로 컴파일한 파일은

python2.7에서는 실행이 불가하고, python3.6으로는 실행이 가능하다.

$ python test.cpython-36.pyc 
RuntimeError: Bad magic number in .pyc file

$ python3 test.cpython-36.pyc 
hello world
aa

 

----

python -m compileall .

[링크 : https://sysops.tistory.com/39]

 

$ pip3 install uncompyle6
$ uncompyle6 -o . your_filename.pyc

[링크 : https://askubuntu.com/questions/153823/how-to-run-a-pyc-compiled-python-file]

[링크 : https://g0pher.tistory.com/364]

'Programming > python(파이썬)' 카테고리의 다른 글

python 관련 문서들  (0) 2020.01.09
python exception  (0) 2020.01.02
python indent  (0) 2019.12.13
tensorflow, pytorch  (0) 2019.12.10
python pip 특정 버전설치 / 목록에서 설치  (0) 2019.09.09
Posted by 구차니

웬지 이유없는 들여쓰기로 블록 구분하는건 안되는 느낌이다.

 

:로 끝나면 한블럭 들어가야 하고 이 경우는 if나 함수 처럼 어떠한 블럭이 강제되는 부분일 경우

들여쓰기를 강제하게 된다.

 

[링크 : https://riptutorial.com/ko/python/example/3952/블록-들여-쓰기]

[링크 :https://offbyone.tistory.com/48]

 

+

그냥 이유없이 들여쓰기 해서 블럭을 쓰고 싶은데 그렇게는 안되는 건가?

문법 수준에서 들여쓰기, 블럭으로 인식을 하다보니 임의의 블럭을 지정을 하지 못하게 하는 듯 하다.

'Programming > python(파이썬)' 카테고리의 다른 글

python exception  (0) 2020.01.02
python 컴파일하기 및 디컴파일?  (0) 2019.12.14
tensorflow, pytorch  (0) 2019.12.10
python pip 특정 버전설치 / 목록에서 설치  (0) 2019.09.09
python expat parseFile()  (0) 2019.06.24
Posted by 구차니
Programming/node.js2019. 12. 10. 17:43

은행사이트 가면 10분 이내에 새로운 페이지 안가면 자동 로그아웃 되는데

이런식으로 token과 refresh token 두개를 이용해서 구현을 하는건가?

JWT가 어려운거냐.. 내가 머리가 안 좋은거냐..

 

[링크 : https://codeforgeek.com/refresh-token-jwt-nodejs-authentication/]

[링크 : https://solidgeargroup.com/refresh-token-with-jwt-authentication-node-js/]

'Programming > node.js' 카테고리의 다른 글

node.js crypto 모듈  (0) 2020.01.19
node.js xpath 그리고 boolean  (0) 2019.12.17
node.js synchornous file write  (0) 2019.11.06
postgres on node.js  (0) 2019.09.24
json2csv / node.js 에서 NULL 값 출력하기  (0) 2019.09.18
Posted by 구차니