1
아래의 C 구조체를 파이썬으로 구현하고 아래 언급 된대로 멤버에 액세스하고자합니다. 어떤 도움을 주셔서 감사합니다어떻게 파이썬 구조의 구조를 만들 수 있습니까?
typedef struct{
unsigned int ch_state;
unsigned int polling;
unsigned int timeout;
unsigned int count;
}channel_Status_t;
typedef struct{
channel_Status_t ch_status;
}channel_num_t
typedef struct{
channel_num_t SR1;
channel_num_t SR2;
channel_num_t LR1;
channel_num_t LR2;
} channel_type_t;
channel_type_t Rx;
channel_type_t Tx;
Rx.SR1.ch_status.ch_state=1;
Rx.SR1.ch_status.polling=10;
Rx.SR1.ch_status.polling=20;
Rx.SR1.ch_status.count=0;
// Should be able to access data as below...
Rx.SR2.ch_status.ch_state=1;
Rx.SR2.ch_status.polling=10;
Rx.SR2.ch_status.polling=20;
Rx.SR2.ch_status.count=0;
더 이상 말할 것도 없습니다. – Apalala