본문 바로가기

IT 세계의 후아

검색하기
IT 세계의 후아
프로필사진 후__아

  • 전체 (55)
    • Coding (43)
      • Python (27)
      • Study (15)
      • Algorithm (1)
    • Recording (12)
      • NewsScrap (10)
      • 취준기록 (0)
      • Etc (2)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
일 월 화 수 목 금 토
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
  • dict
  • Ord
  • 생성형AI
  • AI
  • 경제신문스크랩
  • chr
  • 데이콘경진대회
  • 프로그래머스
  • Python
  • OpenAI
  • 문자열
  • 파이썬
  • listcomprehension
  • 이중리스트
  • rag
  • langchain
  • 백준
  • 랭체인
  • llm
  • 리스트
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록인덱싱 (1)

IT 세계의 후아

[python]문자열 인덱싱

※ 콜론[:]을 활용한 문자열 인덱싱text = 'abcdef'text[0] = 'a'text[0:2] = 'ab'text[-2:0] = 'ef'text[:-3] = 'abc'text[::2] = 'ace'  # 0번째 문자부터 끝까지 2개씩 건너뛰기# 프로그래머스 lv0 코드 처리하기def solution(code): mode = False # 0 ret = "" for i in range(len(code)): if code[i] == "1": # 숫자 1이 아닌 문자열 1이라는 것 놓치지 않기! mode = not mode elif (mode == False and i%2 == 0) or (mode == True and i%2 == ..

Coding/Python 2024. 4. 17. 20:59
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바