ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • for, 문자열
    Cording/Python 2021. 2. 5. 01:19

    list1 = []

    list2 = []

    value = 1

    for i in range(0, 3) : # 0, 1, 2 반복

    for k in range(0, 4) : # 0, 1, 2, 3 반복

    list1.append(value)

    value +=1

    list2.append(list1)

    list1 = []

     

    ===========================

     

    inStr = "   한글 python 프로그래밍   "
    outStr = ""

    for i in range(0, len(inStr)) :
    if inStr[i] != ' ' :
    outstr += instr[i]

    print("원래 문자열 ==> "+'[' + inStr + ']')
    print("공백 삭제 문자열 ==> " + '[' + outStr + ']')

     

    # 중첩된 반복문
    for i in range(1, 10) :
       for j in range(1, 10) :
          print('i는 %d j는 %d'%(i, j))

    i는 1  j는 1
    i는 1  j는 2
    ...

    'Cording > Python' 카테고리의 다른 글

    learning  (1) 2021.02.13
    machine learning  (0) 2021.02.01
    전처리  (0) 2021.01.28
    Graph  (0) 2021.01.22
    jupyter-data visualization  (0) 2021.01.21

    댓글

Designed by Tistory.