import copy words = range(0, 3) words = [str(e+1) for e in words] n = len( words ) tubes = [] for i in range(n): tubes.append( [''] ) numTubes = len(tubes) for i in range(n): for j in range(numTubes): for k in range(len(tubes[j])): tubes[j][k] += words[j] print tubes sumTube = [] for j in range(numTubes): for e in tubes[j]: sumTube.append( e ) for j in range(n): tubes[j] = copy.deepcopy( sumTube )
http://dynamide.tistory.com/1272
[CentOS 5.6에서 Python2.6 + PyQt4 + matplotlib 설치하기] - CentOS 5.6 기준 - Python 2.6 + PyQt4 + matplotlib 1.0 조합 0. 들어가기 전에 - 여러 사람이 쓰는 워크스테이션 또는 클러스터 컴퓨팅 환경이라는 가정 하에, 모든 설치는 root 권한 없이 수행한다. - Windows가 각종 프로그램을 "C:\Program Files" 디렉토리에 모아두는 것처럼, 각종 프로그램은 "/home/user/softwares"라는 디렉토리 아래에 놓기로 한다. 이는 root 권한이 없으므로 설치된 프로그램을 나중에 관리하기 쉽도록 home 디렉토리 밑에 두고자 하는 것이다. 여기서 "user"는 사용자 계정(아이디)을 의미한다. 사용자 계정이 d..
http://www.oak-tree.us/blog/index.php/2009/05/12/pyqt-windows http://www.qtforum.org/article/24337/error-running-qt-application.html QtCore4.dll 등과 같은 Qt의 바이너리들이 여러 프로그램에 포함되어 있기 때문에 내가 사용하고자 하는 버전의 QtCore4.dll이 가장 먼저 인식되도록 조작을 해줘야 한다. 시스템 변수의 path에서 사용하고자 하는 Qt의 dll이 들어있는 폴더가 가장 앞에 오도록 한다. 예를 들면, "...\Qt\qt\bin"와 같은 경로가 path 환경 변수의 가장 앞에 오도록 한다. (※ 참고 : 환경 변수에 의해 참조되는 매틀랩 폴더에도 QtCore4.dll이 들어있다..
# First of all, need to read python doc. about ctypes.. from ctypes import * class Obj(Structure) : _fields_ = [("name", c_char_p), ("id", c_int)] class Person(Structure) : _fields_ = [("stInfo", Obj)] def __init__(self, person=None): self.stInfo = Obj() if person is not None : self.stInfo = person.stInfo def __str__(self) : return "I'm %s, and my id is %d" % (self.stInfo.name, self.stInfo.id) q..
- 먼저 MSVC++(Express 버전)에서 dll을 만든다. dll의 내용이 되는 소스는 다음과 같다. // PyDll.cpp -> PyDll.dll struct St { int x; char * str; double f; }; extern "C" __declspec(dllexport) void func(void* st) { St temp = {1, "Hello", 3.14}; *((St*)st) = temp; } - Python에서 dll을 import한 다음 dll에 정의되어 있는 구조체와 동일한 구조를 갖는 ctypes.Structure를 정의한다. 그 다음 정의한 ctypes.Structure의 객체를 byref()를 통해 dll에 있는 함수에게 넘겨준다. from ctypes import *..
"구조체 정렬 내용 복습하러 가기" ctypes.Structure의 subclass에서 _pack_ 멤버에 정렬 단위 바이트값을 넣어주면 된다. 이는 MSVC에서 #pragma pack(n) 와 동일한 효과이다. >>> class St(Structure) : _fields_ = [("a", c_short), ("b", c_int), ("c", c_longdouble)] # default 정렬값은 4bytes이다. # [short:2bytes][empty 2bytes][int:4bytes][long double:8bytes] = 16bytes >>> sizeof(St) 16 >>> class St(Structure) : _fields_ = [("a", c_short), ("b", c_int), ("c", ..
from distutils.core import setup, Extension module = Extension('_Test', sources=['Test_wrap.cxx',], ) setup (#name = '', #version = '0.1', #author = "", #description = """Simple swig example from docs""", ext_modules = [module], py_modules = ["Test"], )
[문제 상황] 파이썬 문서(http://docs.python.org/extending/windows.html)에 나와있는 대로 따라하는 과정에서 문제가 발생하였다. (컴파일 환경은 Python 3.1 및 Visual C++ 2008 Pro.) 해당 파이썬 문서에는 다음과 같은 내용이 있다. 아주 간편해 보인다. 4. Building C and C++ Extensions on Windows// 중략.. To build extensions using these instructions, you need to have a copy of the Python sources of the same version as your installed Python. You will need Microsoft Visual C++..
- Total
- Today
- Yesterday
- TCGA
- armadillo c++
- GSX 1200 pro
- destructor
- 이상한 문자
- Python
- ctypes
- 설치
- volume dial
- structure
- how to solve it
- Accelerated C++
- tensorflow
- C++
- matrix multiplication
- GSX 1000 pro
- MSVC++
- QPrinter.A4
- dll
- QT
- QPrinter.Letter
- Visual C++
- pandas
- PyQt
- TensorBoard
- 볼륨 조절
- 볼륨 낮춤
- CanDrA
- cython
- Item 9
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |