[Python] Add comments to standard input files
- Module for commenting standard input files
-Last time, I uploaded the method of using a text file for standard input.
-When describing the calculation conditions in this text file, it is inconvenient if the value is not stated.
・ Therefore, I created an input module that allows you to set rules and write comments.
-The rule decided to judge the comment after'#' according to the Python code.
def input_aif (): Valid data before #'#'
s = input()
start = s.find ('#') #'#' Find the first position
if start> 0: s = s [: start] # Extract the previous slices
s = s.rstrip () # Remove whitespace on the right side (tabs and line breaks are also removed)
return s
It may not be used in this way, but I think it's easy to use because it matches the coding rules of python.
Supervised, thank you.