현재 디렉토리에 "hello.jl"텍스트 파일을 감안할 때 :
" Example hello world program."
function hello()
println("hello, world")
end
는 줄리아 1.0.0 REPL이 표시 얼마나?
지금까지 가지고있는 것입니다 :
julia> disp(f) = for line in readlines(open(f)); println(line); end
disp (generic function with 1 method)
julia> disp("hello.jl")
" Example hello world program."
function hello()
println("hello, world")
end
거기에 내장 된 줄리아에서이 작업을 수행하는 명령?
- 답변 # 1
- 답변 # 2
run
를 사용할 수 있습니다 기능과Cmd
를 전달 Linux에서cat
를 실행하기위한 인수 시스템 명령.세미콜론
;
유형 쉘모드로 변경하려면 다음을 수행하십시오.shell> cat hello.jl "Example hello world program." function hello() println("hello, world") end
와이즈 비즈 사용 Julia 외부에서 명령을 실행하는 함수 :
run
Windows에서
julia> run(`cat hello.jl`) # Only works on Unix like systems. "Example hello world program." function hello() println("hello, world") end Process(`cat hello.jl`, ProcessExited(0))
명령은 유닉스type
와 유사해야합니다 :cat
julia> show_file(path::AbstractString) = run(@static Sys.isunix() ? `cat $path` : `type $path`) show_file (generic function with 1 method)
run
를 반환 개체 :Process
세미콜론
julia> show_file("hello.jl") "Example hello world program." function hello() println("hello, world") end Process(`cat hello.jl`, ProcessExited(0))
사용 라인의 끝에서, 상기 복귀 REPL 출력을 억제;
또는
julia> show_file("hello.jl"); "Example hello world program." function hello() println("hello, world") end
를 반환 할 수도 있습니다.nothing
의 끝에서 원한다면 - 답변 # 3
show_file
또는
println(String(read("hello.jl")))
"hello.jl" |> read |> String |> println
관련 자료
- python - 텍스트 파일을 문자열 또는 목록으로 변환
- java - 주어진 문자열의 파일 크기를 어떻게 얻습니까?
- reactjs - 반응에서 텍스트 파일을 읽는 방법
- python - 이로부터 py 파일을 어떻게 얻습니까?
- javascript - 루프에서 항목의 텍스트 변경
- ruby on rails - CSV 파일 텍스트에 텍스트 서식 추가
- Add different text to the last line of a string - 문자열의 마지막 줄에 다른 텍스트를 추가하십시오C # LINQ
- ios - 텍스트의 일부를 취소하는 방법
- google search console - 텍스트 (txt) 파일을 "noindex"하려면 어떻게합니까?
- android - EditText 메뉴 항목의 텍스트를 어떻게 설정합니까?
- python - 폴더의 첫 번째 파일을 열려면 어떻게합니까
- 파이썬으로 텍스트 파일에서 텍스트 패턴을 찾는 방법은 무엇입니까?
- html - div 하단의 텍스트
- python - for 루프 내부의 텍스트 길이를 얻는 방법
- bash - (정규식) 내에서 텍스트를 파일로 만드는 방법
- c# - 텍스트 파일에서 읽은 다음 평균을 계산하는 방법
- javascript - _satellitepageBottom ()을 넣을 수 있습니까? JS 파일에?
- excel - 정렬 기능이 파일을 충돌시킵니다
- Perl을 사용하여 텍스트 파일을 csv 파일로 구문 분석하는 방법
- python - 출력을 텍스트 파일로 저장
- OpenCv의 폴더에서 여러 이미지 읽기 (python)
- 파이썬 셀레늄 모든 "href"속성 가져 오기
- html - 자바 스크립트 - 클릭 후 변경 버튼 텍스트 변경
- javascript - 현재 URL에서 특정 div 만 새로 고침/새로 고침
- JSP에 대한 클래스를 컴파일 할 수 없습니다
- JavaScript 변수를 HTML div에 '출력'하는 방법
- git commit - 자식 - 로컬 커밋 된 파일에 대한 변경을 취소하는 방법
- jquery - JavaScript로 현재 세션 값을 얻으시겠습니까?
- javascript - swiperjs에서 정지, 재생 버튼 추가
- python - 화면에서 찾은 요소를 찾을 수없는 경우 셀레늄
줄리아 REPL에서 히트
는 REPL에 내장 된 쉘 모드, 다음
에 도착합니다