I came to read csv, but I have a small forgetfulness The memorandum
input() Needless to say, input function As a caveat, it should be used each time
Even if input () is the same, each line is read in the order in which they appear.
#text file
yakyuu
soccer
tablegame
#Read
sono1 = input() #Baseball reads
sono2 = input() #soccer loads
sono3 = input() #tablegame loads
#Etc. input()Even if the code is the same in the form of
#The first time is the first line,Be careful because the second time corresponds to the second line etc.
#text file
apple banana
# "apple banana"Enter
a, b = input().split()
#Output with apple
print(a)
#output with banana
print(b)
#text file
10 20
# "10 20"Enter
input_list = input().split()
# ['10','20']And output
print(input_list)
Click here if you want to change from input to int as it is
#text file
2 3
#Application of for syntax
a,b = (int(x) for x in input().split())
print(a*b)
#output
6
Recommended Posts