본문 바로가기

learning/Python9

[LeetCode 3] Longest Substring Without Repeating Characters 풀이 문제 : 단어 변수 s를 받고 반복되지 않는 글자 수의 최댓값 return 하기 예시 : "abcabcbb" 에서 "abc" 가 중복되지 않으면서 글자수가 가장 김. 따라서 답은 3 풀이 : 변수 초기값 설정한다. used : 사용한 알파벳과 위치를 저장하기 위한 빈 dictionary max_length : 최대 단어 길이 start : 단어 길이를 재기 위한 시작 위치 used = {} max_length = start = 0 단어를 loop에 넣는다. 알파벳 길이를 쉽게 알기 위해 enumerate를 씌운다. for idx, c in enumerate(s): 아래 코드부터는 모두 loop 안에 들어간다. 딕셔너리에 순번인 알파벳(c)이 들어있고, 그 알파벳의 기존 위치가 start 변수 값보다 크면.. 2022. 12. 27.
Anaconda powershell 로 python 파일 돌리기 conda activate python3 cd 경로 dir python 파일명.py ex) conda activate python3 cd C:\workspaces\python dir python weather.py 0 1 2022. 9. 27.
[Linux] 배치 걸기 - crontab crontab: 특정 시간에 특정 프로그램을 주기적으로 수행시키는 프로그램 cmd에서 crontab -l 검색하면 readme 같은 파일을 볼 수 있다. 예시 - 날씨 한국시간 기준 매시각 10, 25, 40분 마다 크롤링 10,25,40 * * * * sh /home/weather_hourly_batch.sh 사용법 참조 : https://jdm.kr/blog/2 시간 설정 참조 : https://velog.io/@jay2u8809/Crontab%ED%81%AC%EB%A1%A0%ED%83%AD-%EC%8B%9C%EA%B0%84-%EC%84%A4%EC%A0%95 Crontab(크론탭) 시간 설정 Crontab의 시간 설정 > 배치Batch처럼 특정 시간에 정기적으로 Shell Script나 프로그램을 실.. 2022. 9. 16.
request 크롤링에 유용한 사이트 및 프로그램 json editor - json을 예쁘게 보준다 https://jsoneditoronline.org/#left=local.qowagi&right=local.pazezu JSON Editor Online: JSON editor, JSON formatter, query JSON You need to enable JavaScript to run this app. News Secure connection and open urls via proxy 2022-07-19 JSON Editor Online now enforces a secure connection (https), which is better for, you know, security. This does not allow to load urls fro.. 2022. 8. 17.
[Linux] 기타 코드 파일 복붙 cp -R 복사하고싶은파일위치 붙여놓고싶은위치/ 2022. 6. 22.
[Python] directory [현재 경로] direct = os.getcwd() [폴더 만들기] answer = './results' if os.path.exists(answer): pass else: os.mkdir(answer) [경로 안 파일 리스트] DirectoryFiles = os.listdir(answer) for oneFile in DirectoryFiles : filePath = os.path.join(answer, oneFile) 2022. 6. 3.