노트북에서 코드로 변경하는 방법

 

from notebook.auth import passwd
passwd()

 

 

 

'python' 카테고리의 다른 글

python 오브젝트 함수,변수 리스트  (0) 2018.04.02
디렉토리 순회  (0) 2018.03.09
dictionary sort  (0) 2018.02.19
python2 utf8인코딩  (0) 2017.07.29
python string to dict or list etc...  (0) 2016.12.29
Posted by rjh
,

#a= some object


# method list

import inspect
inspect.getmembers(a, predicate=inspect.ismethod)


# attribute list

vars(a)

'python' 카테고리의 다른 글

jupyter notebook 비밀번호 변경  (0) 2021.09.28
디렉토리 순회  (0) 2018.03.09
dictionary sort  (0) 2018.02.19
python2 utf8인코딩  (0) 2017.07.29
python string to dict or list etc...  (0) 2016.12.29
Posted by rjh
,

디렉토리 순회

python 2018. 3. 9. 18:03

import os

def search(dirname):
  filenames = os.listdir(dirname)
  for filename in filenames:
    full_filename = os.path.join(dirname, filename)
    if os.path.isdir(full_filename):
      search(full_filename)
    else:
      #todo

'python' 카테고리의 다른 글

jupyter notebook 비밀번호 변경  (0) 2021.09.28
python 오브젝트 함수,변수 리스트  (0) 2018.04.02
dictionary sort  (0) 2018.02.19
python2 utf8인코딩  (0) 2017.07.29
python string to dict or list etc...  (0) 2016.12.29
Posted by rjh
,

dictionary sort

python 2018. 2. 19. 10:43

sorted(d.items(), key=lambda x: x[1])


key로 정렬 - x[0]

'python' 카테고리의 다른 글

jupyter notebook 비밀번호 변경  (0) 2021.09.28
python 오브젝트 함수,변수 리스트  (0) 2018.04.02
디렉토리 순회  (0) 2018.03.09
python2 utf8인코딩  (0) 2017.07.29
python string to dict or list etc...  (0) 2016.12.29
Posted by rjh
,

python2 utf8인코딩

python 2017. 7. 29. 16:06

1. utf8 형식으로 코딩됨 알림

코드시작부분에 추가


#-*- coding: utf-8 -*-



2. 유니코드 스트링

string 앞에 u를 입력


u'가나다라'



3. utf8 파일


import codecs

codecs.open('filename','읽기쓰기',encoding='utf8')



'python' 카테고리의 다른 글

jupyter notebook 비밀번호 변경  (0) 2021.09.28
python 오브젝트 함수,변수 리스트  (0) 2018.04.02
디렉토리 순회  (0) 2018.03.09
dictionary sort  (0) 2018.02.19
python string to dict or list etc...  (0) 2016.12.29
Posted by rjh
,

스트링으로 저장된 dictionary나 list 들을 바꾸는방법



import ast


a = "{ 'a':1, ...  }"


d = ast.literal_eval(a)


b="['a','b']"


d = ast.literal_eval(b)


'python' 카테고리의 다른 글

jupyter notebook 비밀번호 변경  (0) 2021.09.28
python 오브젝트 함수,변수 리스트  (0) 2018.04.02
디렉토리 순회  (0) 2018.03.09
dictionary sort  (0) 2018.02.19
python2 utf8인코딩  (0) 2017.07.29
Posted by rjh
,