알아가기/Python 5

[Python] mysqlclient 설치 오류 Can not find valid pkg-config name

mysqlclient 오류 메시지 root@2230da7c6145:/code/backend# pip install mysqlclient Collecting mysqlclient Downloading mysqlclient-2.2.1.tar.gz (89 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.0/90.0 kB 4.1 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successf..

알아가기/Python 2023.12.19

[Python] 교집합, 합집합, 차집합, 대칭 차집합

파이썬에서 적용되는 네 가지 집합 기호를 확인해 본다. set 자료형으로 이루어진 a, b 집합의 원소가 각 집합 연산에 따른 예를 살펴보자. 교집합 set_a = set([1, 2, 3, 4, 5]) set_b = set([4, 5, 6, 7, 8]) result = set_a & set_b print(result) # {4, 5} 합집합 set_a = set([1, 2, 3, 4, 5]) set_b = set([4, 5, 6, 7, 8]) result = set_a | set_b print(result) # {1, 2, 3, 4, 5, 6, 7, 8} 차집합 set_a = set([1, 2, 3, 4, 5]) set_b = set([4, 5, 6, 7, 8]) result = set_a - set_b..

알아가기/Python 2023.01.05

[Python] 리스트 안의 문자 붙여서 출력

리스트 출력 방법 리스트를 바로 print() 함수를 써서 출력하게 되면 각각의 value 는 빈칸으로 분리되어 출력된다. 이 출력이 필요할때는 편하긴 한데 빈칸없이 출력을 하려고 한다면 항상 찾아보게 된다. 이러한 필요성에 의해 기록을 남겨둔다. 간단하게 프린트 할 수 있는 두 가지 방법으로, print(*LIST, sep="") print("".join(LIST)) 가 있다. 이때, LIST 는 문자형 리스트 이다. 숫자, 문자 리스트에 대한 간단한 예시 입력 코드 ## integer number_ls = [1, 2, 3, 4, 5] print(number_ls) print(*number_ls) print(*number_ls, sep="") # print("".join(number_ls)) # Typ..

알아가기/Python 2022.12.31

[Python] __name__ 을 프린트 해보자

__name__ == "__main__" 에 대해 알아보기 위해 __name__ 을 프린트해본다. 프린트 __name__ 기본적으로 __name__ 을 프린트 문으로 출력해보면 __main__ 이 출력된다. 다음으로 if __name__ == "__main__": 로 감싼 후 프린트해보면 동일하게 __main__ 출력되어 나온다. if 문이 정상적으로 동작했음을 알 수 있다. 두 개로 분리된 파일에서의 __name__ # mainfile.py import funcfile print(funcfile.fnHello("MAIN")) print(f'PRINT __name__ from mainfile: {__name__}') # funcfile.py def fnHello(inputname): return f'He..

알아가기/Python 2022.10.10