본문 바로가기

Research/Python25

Python_학습자료 모음 Documentation Official Python 3 Documentation - "official"/technical explanation of what a particular function/operator does, examples of correct syntax, what the various libraries are, etc. PEP 8 - Style Guide for Python Code - learn what is good and bad style in Python Textbooks Dive Into Python - another survey of Python syntax, datatypes, etc. Think Python by Allen Downey - a good general ov.. 2023. 6. 7.
Python_가장 긴 알파벳 정렬된 substring 찾는 코드 alphabet = 'abcdefghijklmnopqrstuvwxyz' topLength = 0; topString = ''; for index in range(len(s)): memory = '' # a for chr in s[index:]: if(memory == ''): memory += chr elif(alphabet.index(memory[-1]) topLength): topLength = len(memory) topString = memory print(topString) s는 input으로 들어온 스트링이다. 예를 들어 'abcdefclkwjefl'와 같다. 가장 긴 substring을 저장하기 위해 topLength와 topString으로 길이 수와 substring 자체를 저장하는 변수를.. 2023. 6. 6.
python_nohup으로 앱 24시간 켜두기 python 스크래핑 서버를 백그라운드에서 돌리고 싶어졌다. nohup python main.py & // nohup: ignoring input and appending output to 'nohup.out' nohup으로 백그라운드(&) 실행행하는 명령어를 기입했지만 ignoring input and appending.. 에러가 발생했다. 한 블로그에 따르면 nohup으로 실행하기 위해 권한이 755 이상이어야 한다고 한다. $ chmod 755 main.py // nohup: ignoring input and appending output to 'nohup.out' 권한을 부여한 뒤 실행해보았지만 같은 에러가 발생한다. .. 아니 했다. 자세히보니 커서가 멈춰있음을 알게 되었다. 멈춰있다는 말은 무.. 2023. 4. 17.
shootingstar_성공로그_Selenium 스크래퍼 flask 서버 EC2 Linux에 배포하기 EC2에 Sellenium 스크래핑 앱을 flask 서버로 띄우려는 시도를 한번 했는데 실패했다. 관련 파일들이 퍼즐처럼 꼬여서 다시 EC2를 파서 진행한다. 리눅스 접속 Ubuntu 대신 Amazon Linux 2023으로 진행해보자. ssh로 EC2 linux 접속 초기화 //새 스크린에서 루트 유저로 시작하기 screen sudo su 패키지 설치 yum install python3 -y yum install git -y yum install pip pip install virtualenv 가상환경 설정 // 가상환경 생성 후 activate virtualenv -p python3.9 my_app source ./my_app/bin/activate browser 및 driver 다운로드 // 브라우.. 2023. 4. 14.