Python TypeError : 인쇄를 시도 할 때 'str'및 'int'개체를 연결할 수 없습니다.

케베 란

초 단위로 시간이 걸리고 분 : 초 단위로 시간을 출력하는 계산기를 만들려고 할 때이 문제가 발생하고이 오류가 발생합니다.

오류

이것은 내 코드입니다.

timeInSeconds = 1823
timeInMinutes = timeInSeconds / 60
timeInRest = timeInSeconds % 60

str(timeInMinutes)
str(timeInRest)

print("Your time in minutes and seconds is " + timeInMinutes + ":" + timeInRest)
Shiverz

새 값을 다시 할당하는 것을 잊었습니다.

timeInSeconds = 1823
timeInMinutes = timeInSeconds / 60
timeInRest = timeInSeconds % 60

timeInMinutes = str(timeInMinutes)
timeInRest = str(timeInRest)

print("Your time in minutes and seconds is " + timeInMinutes + ":" + timeInRest)

기본적으로 이렇게 :

str(timeInMinutes)

TimeInMinutes 변수가 이제 문자열이라는 의미는 아닙니다. 다음과 같이 다시 할당해야합니다.

timeInMinutes = str(timeInMinutes)

나는 이것이 당신이 의도 한 것이라고 믿습니다.


그러나 나중에 int 값을 유지하는 것이 유용 할 수 있습니다. 이 경우 다음과 같이 새 변수를 만들 수 있습니다.

timeInMinutesStr = str(timeInMinutes)
timeInRestStr = str(timeInRest)

print("Your time in minutes and seconds is " + timeInMinutesStr + ":" + timeInRestStr)

또는 나중에 사용하지 않을 새 변수를 할당 할 필요가 없도록 인쇄에서 직접 값을 변환 할 수 있습니다.

print("Your time in minutes and seconds is " + str(timeInMinutes) + ":" + str(timeInRest))

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Python Selenium TypeError : 'str'및 'WebElement'개체를 연결할 수 없습니다.

분류에서Dev

TypeError : 'str'및 'float'개체를 연결할 수 없습니다. : Pandas

분류에서Dev

Python : TypeError : 'str'과 'int'를 연결할 수 없습니다.

분류에서Dev

TypeError : scrapy.Request ()에 맞춤 URL을 배치 할 때 'str'및 'NoneType'개체를 연결할 수 없습니다.

분류에서Dev

TypeError : 'str'및 'function'객체를 연결할 수 없습니다.

분류에서Dev

Tkinter Label, TypeError : 'str'및 'instance'개체를 연결할 수 없습니다.

분류에서Dev

TypeError : Flask의 'str'및 'float'개체를 MySQL과 연결할 수 없습니다.

분류에서Dev

Python 오류 : 'str'및 'builtin_function_or_method'개체를 연결할 수 없습니다.

분류에서Dev

Python TypeError : 메시지의 이메일 본문 부분에서 'str'및 'list'개체를 연결할 수 없습니다.

분류에서Dev

Python에서 str과 int를 연결할 수 없습니다.

분류에서Dev

re.search () TypeError : 'str'및 'NoneType'객체를 연결할 수 없습니다.

분류에서Dev

시리즈를 호출 할 때 Python, Pandas 및 NLTK 유형 오류 'int'개체를 호출 할 수 없습니다.

분류에서Dev

TypeError : '<class'str '>'유형의 개체를 연결할 수 없습니다. Series 및 DataFrame obj 만 유효합니다.

분류에서Dev

TypeError : 'str'과 'NoneType'객체를 연결할 수 없습니다 .python BS4

분류에서Dev

TypeError : print를 호출 할 때 'str'개체를 호출 할 수 없습니다.

분류에서Dev

Python Script TypeError : 'int'개체를 호출 할 수 없습니다.

분류에서Dev

Python setter TypeError : 'int'개체를 호출 할 수 없습니다.

분류에서Dev

TypeError : 파일을 읽을 때 'str'개체를 호출 할 수 없습니다.

분류에서Dev

TypeError : 'int'객체를 암시 적으로 str로 변환 할 수 없습니다 (python)

분류에서Dev

형식 오류는 'str'및 'ErrorList'개체를 연결할 수 없습니다.

분류에서Dev

TypeError : Fib에서 암시 적으로 'int'개체를 str로 변환 할 수 없습니다.

분류에서Dev

TypeError : 시계열이 섞일 때 비 NDFrame 개체를 연결할 수 없습니다.

분류에서Dev

TypeError : str에 바이트를 연결할 수 없습니다.

분류에서Dev

TypeError : 'list'개체를 암시 적으로 str로 변환 할 수 없습니다.

분류에서Dev

Python 표시 :-TypeError : 코드를 실행하는 동안 Python에서 'int'개체를 호출 할 수 없습니다.

분류에서Dev

TypeError : int를 str로 암시 적으로 변환 할 수 없습니다.

분류에서Dev

django-selenium TypeError : 'str'개체를 호출 할 수 없습니다.

분류에서Dev

addObject를 시도 할 때 개체는 nil 일 수 없습니다.

분류에서Dev

Python str () : TypeError : 'str'객체를 호출 할 수 없습니다-중지 코드

Related 관련 기사

  1. 1

    Python Selenium TypeError : 'str'및 'WebElement'개체를 연결할 수 없습니다.

  2. 2

    TypeError : 'str'및 'float'개체를 연결할 수 없습니다. : Pandas

  3. 3

    Python : TypeError : 'str'과 'int'를 연결할 수 없습니다.

  4. 4

    TypeError : scrapy.Request ()에 맞춤 URL을 배치 할 때 'str'및 'NoneType'개체를 연결할 수 없습니다.

  5. 5

    TypeError : 'str'및 'function'객체를 연결할 수 없습니다.

  6. 6

    Tkinter Label, TypeError : 'str'및 'instance'개체를 연결할 수 없습니다.

  7. 7

    TypeError : Flask의 'str'및 'float'개체를 MySQL과 연결할 수 없습니다.

  8. 8

    Python 오류 : 'str'및 'builtin_function_or_method'개체를 연결할 수 없습니다.

  9. 9

    Python TypeError : 메시지의 이메일 본문 부분에서 'str'및 'list'개체를 연결할 수 없습니다.

  10. 10

    Python에서 str과 int를 연결할 수 없습니다.

  11. 11

    re.search () TypeError : 'str'및 'NoneType'객체를 연결할 수 없습니다.

  12. 12

    시리즈를 호출 할 때 Python, Pandas 및 NLTK 유형 오류 'int'개체를 호출 할 수 없습니다.

  13. 13

    TypeError : '<class'str '>'유형의 개체를 연결할 수 없습니다. Series 및 DataFrame obj 만 유효합니다.

  14. 14

    TypeError : 'str'과 'NoneType'객체를 연결할 수 없습니다 .python BS4

  15. 15

    TypeError : print를 호출 할 때 'str'개체를 호출 할 수 없습니다.

  16. 16

    Python Script TypeError : 'int'개체를 호출 할 수 없습니다.

  17. 17

    Python setter TypeError : 'int'개체를 호출 할 수 없습니다.

  18. 18

    TypeError : 파일을 읽을 때 'str'개체를 호출 할 수 없습니다.

  19. 19

    TypeError : 'int'객체를 암시 적으로 str로 변환 할 수 없습니다 (python)

  20. 20

    형식 오류는 'str'및 'ErrorList'개체를 연결할 수 없습니다.

  21. 21

    TypeError : Fib에서 암시 적으로 'int'개체를 str로 변환 할 수 없습니다.

  22. 22

    TypeError : 시계열이 섞일 때 비 NDFrame 개체를 연결할 수 없습니다.

  23. 23

    TypeError : str에 바이트를 연결할 수 없습니다.

  24. 24

    TypeError : 'list'개체를 암시 적으로 str로 변환 할 수 없습니다.

  25. 25

    Python 표시 :-TypeError : 코드를 실행하는 동안 Python에서 'int'개체를 호출 할 수 없습니다.

  26. 26

    TypeError : int를 str로 암시 적으로 변환 할 수 없습니다.

  27. 27

    django-selenium TypeError : 'str'개체를 호출 할 수 없습니다.

  28. 28

    addObject를 시도 할 때 개체는 nil 일 수 없습니다.

  29. 29

    Python str () : TypeError : 'str'객체를 호출 할 수 없습니다-중지 코드

뜨겁다태그

보관