기본 콘텐츠로 건너뛰기

라벨이 program인 게시물 표시

ie는 <meta http-equiv="content-type" content="text/html;charset=utf-8" />를 모른다?

윈도 ie는 헤더 파일에 설정된 <meta http-equiv="content-type" content="text/html;charset=utf-8" /> 태그를 인식하지 못하네요. 아파치를 사용한다면 http.conf에서 AddDefaultCharset utf-8 을 추가하면 되지만 모든 문서의 인코딩이 utf-8 아니라면 스크립팅 언어에서 설정도 가능합니다. php> <?php header('Content-Type: text/html; charset=UTF-8'); ?>

mod_python 3.3.1

mod_python홈 설치후 아파치 설정에 다음 라인을 추가 후 재시작. LoadModule python_module modules/mod_python.so psp를 사용하기 위해서는 다음 라인도 추가 AddHandler mod_python .psp PythonHandler mod_python.psp

윈도우용 libxml, libxslt

뭐하나 하려면 참 복잡하네요... 파이썬에서 xml을 처리하려고 하는데, 괜히 파이썬을 최신버전으로 설치했다가..ㅜㅜ 최신버전용 패키지들은 아직 없는 것들이 많다는... http://xmlsoft.org/sources/win32/ 에서 바이너리 배포파일을 찾을 수 있습니다.

Installing setuptools

installing setuptools 안정적인 버전의 setuptool을 설치하려면 EasyInstall Installation Instructions 을 참조하세요. 파이썬 기본 디렉토리이외에 설치하려면 Custom Installation Locations 부분을 참조하시면 됩니다. 개발버전을 설치하려면 일단 안정버전을 설치한 후 다음을 실행하세요. ez_setup.py setuptools==dev 이 명령은 Python Subversion sandbox에서 개발버전을 다운로드해서 설치합니다.

python sqlite3 db 생성하기

python-sqlite3.html import  sqlite3 # test db(file name) # :memory: means RAM db  =  '''test_db''' sql_t_person  =  '''create table person (name text)''' def  main ():      con  =  sqlite3 . connect ( db )      con . isolation_level  =  None  # autocommit      cur  =  con . cursor ()      # create test_db      cur . execute ( sql_t_person )      cur . close ()      return  0 if  __name__  ==  '__main__' :  main ()

한줄 입력을 Text widget에 출력-grid를 이용

from  tkinter  import  * class  mDialog :      def  __init__ ( self ,  master ):          frame  =  Frame ( master )          frame . pack ()                   #출력을 위한 Text 위젯          self . textbox  =  Text ( frame ,  width = 50 ,  height = 5 )          self . textbox . grid ( row = 0 ,  columnspan = 2 )                   #한줄 입력을 위한 위젯, Entry          self . input  =  Entry ( frame ,  width = 50 )          self . input . grid ( row = 1 ,  column = 0 ) ...

tkinter한줄 입력받아 출력하기

from tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() #한줄 입력을 위한 위젯, Entry self.input = Entry(frame) self.input.pack(side=LEFT) self.button = Button(frame, text="입력", command=self.output) self.button.pack(side=LEFT) def output(self): #입력받은 내용을 출력 #Entry.get() print(self.input.get()) def main(): root = Tk() app = App(root) root.mainloop() if __name__ == '__main__': main()

python tkinter "Hello, world!"

python3.1 from tkinter import * root = Tk() w = Label(root, text="Hello, world!") w.pack() root.mainloop() 결과는 다음과 같습니다.^^ 파이썬 2대에서 모듈명의 첫 대문자 T가 소문자t로 바뀌었습니다.