python_18
2021. 2. 2. 18:47ㆍpython
'''
입력과 출력
파일 객체(object) = open("파일명","파일 열기 모드(r(읽기)w(쓰기)a(추가))
파일 객체.close
'''
from os import write
# a = open("~/example.txt", 'w') # name 'w' is not defined '' 필수
# a.close
# a=open("example.txt",'w')
# for i in range(1,11):
# data= "%d줄이 출력중입니다"% i
# a.write(data)
# a.close
# a = open("example.txt", 'a')
# for i in range(11,20):
# data ="%d번째 줄 입니다." %i
# a.write(data)
# a.close
# with open("example.txt",'w') as i: # with 사용시 close를 사용하지 않아도 자동으로 열고 닫아준다.
# i.write("hello")
import sys
args=sys.argv[1:]
for i in args:
print(i)