Session3 : Today's Learning

Austin Jiuk Kim·2022년 3월 21일
0

LikeLion

목록 보기
2/2
post-thumbnail

The sequence of methods in the same command line

# If there are a sequence of methods in the same command line, methods are executed from left to right.

string1 = "2022-03-21"

string1.replace('-','/').replace('2022/0','')

print(string1)

# "3/21"

Another effective way to input arguments at Terminal

# Instead of using 'input()', you can use 'readline()' method from 'stdin' module of 'sys' package. 

import sys

n = sys.stdin.readline().rstrip()

# you'd better use '.rstrip()' to remove the following '\n'.
profile
그냥 돼지

0개의 댓글