2017-02-15 5 views
1

여기서 내가 뭘 잘못하고 있니?파이썬에서 노트에 경로 추가

내 주피터 노트에 경로를 추가 할 수 없습니다. 나는 붙어있다. 내 시도는 전혀 작동하지 않았다.

home_dir="\C:\Users\User\Desktop\" data_dir=home_dir + "\C:\Users\User\Desktop\A Student's Guide to Python for Physical Modeling by KInder and Nelson\code" data_set=np.loadtxt(data_dir + "HIVseries.csv", delimiter=',')

+0

'\ C : \ Users \ User \ Desktop \ Kinder와 Nelson에 의한 물리적 모델링을위한 Python 학생용 안내서 \ code'는 절대 파일 경로이며, 다른 루트 디렉토리 접두어를 추가하면 무효가됩니다. –

답변

1

C:\\Users\\User\\Desktop\\A Student's Guide to Python for Physical Modeling by KInder and Nelson\\code\C:\Users\User\Desktop\A Student's Guide to Python for Physical Modeling by KInder and Nelson\code을 수정, 쉬운 질문입니다.

+0

죄송합니다. "\\"을 (를) 추가하려고 시도하지 않았습니다. 당신의 대답을 주셔서 감사합니다. – sweetgirl16

0

변경과 같은 코드의 두 번째 줄 :

home_dir = "\C:\Users\User\Desktop\" 
data_dir = home_dir + "A Student's Guide to Python for Physical Modeling by KInder and Nelson\code" 
data_set = np.loadtxt(data_dir + "HIVseries.csv", delimiter=',') 

코드는 데이터 디렉토리에 홈 디렉토리를 추가합니다. 집을 다시 포함시키지 마십시오. 상대 경로 만 제공하면 효과가 있습니다.

올바른 경로가 아닌 data_dir\C:\Users\User\Desktop\\C:\Users\User\Desktop\A Student's Guide to Python for Physical Modeling by KInder and Nelson\code과 같습니다.