강의

멘토링

커뮤니티

Inflearn Community Q&A

sungwoo124255838's profile image
sungwoo124255838

asked

[Renewed] Python Introduction and Web Scraping Basics Bootcamp [Python, Web, Data Understanding Fundamentals] (Updated)

Learning Python Basics Most Naturally Through Problem Solving: Using Strings, Lists, and Conditional Statements 1

Exercise 18질문드려요

Written on

·

189

0

14'05초

안녕하세요, 

주민등록번호는 숫자이니까, 

data=int(input())

print(data[0:2])

로도 할수 있을것 같은데 이렇게 하는 경우 에러가 나네요.

인풋을 정수로 바꾸면 슬라이싱이 되지 않는건가요? 

답변 부탁드리겠습니다. 감사합니다.

웹-크롤링python

Answer 1

0

funcoding님의 프로필 이미지
funcoding
Instructor

안녕하세요.

data 타입이 int 이면, [0:2] 와 같이 슬라이싱이 되지 않습니다. 문자열에 대해서만 가능합니다.

sungwoo124255838's profile image
sungwoo124255838

asked

Ask a question