전체 글
-
1010 tueToday I Learned 2023. 10. 10. 16:49
파이썬 네트워크 프로그래밍 모듈 - ipaddress 모듈 - socket 모듈 객체(속성,메서드) ipaddress.ip_address // ip 주소 객체 생성 ipaddress.ip_network // 네트워크 주소 객체 생성 192.0.2.1 에서 앞에 3칸 네트워크주소, 마지막 256개의 주소 범위 할당 ㄱㄴ import ipaddress net4 = ipaddress.ip_network('192.0.2.0/24') print(net4) print(net4.num_addresses) #해당 네트워크가 가질 수 있는 ?개수? #네트워크가 256명을 가질 수 있고 net5 = ipaddress.ip_network('192.0.2.0/24') host_list=net5.hosts() print(lis..
-
0921 파이썬 노트 필기Programming/Python 2023. 9. 21. 10:48
formal parameter 형식 파라미터 어떤 값이 들어온다고 생각하고 가정하고 호출 actural parameter : MY_NAME 형식 값에 실제값이 할당되는 것 : 함수 호출 정의될 때 사용되는 게 형식 파라미터 , 구체적인 값이 아닌 틀만 gloabal v ( 글로벌이라는 예약어 통해 함수 안에서도 전역함수를 쓸 수 있도록 함) = 전역변수 선언 pass 키워드 : 함수 몸체의 작성을 잠시 보류할 때 사용 문법적 오류를 피하고 아무것도 실행하지 않을 때 사용 객체 - 속성과 메소드(함수) 로 구성되어있다. 객체에 따라 속성이나 메서드가 많을 수도 적을 수도 있음. 속성 : 객체의 상태 메소드 : 객체의 동작 class - object - 속성, 메서드 속성 > 멤버 변수, 멤버 필드 메서드 ..
-
Python : ListProgramming/Python 2023. 9. 19. 16:47
파이썬의 자료구조 리스트 [ ] 리스트의 인덱싱과 슬라이싱 squares = [1,4,9,16,25] squares[-1] : 마지막 요소 squares[0,4] : 0부터 4-1까지 리스트 합치기 리스트a + 리스트b 연산자 오버로딩 데이터형식이에 따라서 결과값이 다름 일반 숫자에서 +와 리스트의 +가 다른 것처럼 operate overloading 중첩리스트 2차원 리스트 2차원리스트 list2d[0] list2d[0]은 첫번째줄 객체 객체 : 2가지 형태의 속성으로 ( 속성: 값 , 메소드: 객체에 소속된 함수 )로 구성 메소드 ex : 내장함수, sum, min, max 등 sort 는 원래 리스트 그대로, 정렬된 새로운 리스트를 만들어줌 DEFAULT : 오름차순 reverse=True : 역순..
-
파이썬 0914카테고리 없음 2023. 9. 14. 10:42
연산자 operator| 피연산자 operand - 지정 연산자 assignment operator = 대입연산자 - 산술 연산자 arithmetic operator ㅁ 정수나눗셈 // ㅁ 나머지 % 관계 연산자 relation operator = 비교 연산자 ㅁ 항의 대소관계 또는 동등고나계 판정 ㅁ 연산결과는 True 참 또는 False 거짓 논리 연산자 logical operator ㅁ 논리곱 and, 논리합 or, 논리부정 not 논리연산의 결과는 진리표, 연산의 우선순위 멤버 연산자 membership operator ( in ) 특정 문자열 또는 값이 문자열 또는 리스트에 속해 있는지 판별하는 연산자 'py' in 'python' 'ty' not in 'python' 식별 연산자 identit..