[Python] Add comments to standard input files

  1. 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.

Recommended Posts

[Python] Add comments to standard input files
[Python] Standard input
Python3 standard input I tried to summarize
[Python] About standard input
Python: Use zipfile to unzip from standard input
[Python3] Standard input [Cheat sheet]
Receiving standard input tips @ python
How to add page numbers to PDF files (in Python)
[Python] How to use input ()
Allow Python to select strings in input files from folders
[Introduction to Udemy Python 3 + Application] 31. Comments
Matrix representation with Python standard input
Add Python 2.7 Japanese documentation to Dash.app
Useful to remember! 10 Python Standard Libraries
Add TRACE log level to Python ...?
Python Paiza-Various skill checks and standard input
How to write Python document comments (Docstrings)
[Introduction to Udemy Python3 + Application] 41. Input function
[Python] Add total rows to Pandas DataFrame
Add Gaussian noise to images with python2.7
Convert HEIC files to PNG files with Python
How to add python module to anaconda environment
Add a Python virtual environment to VSCode
How to read standard input or variable files at the same time like paste command in Python
Want to add type hints to your Python decorator?
Updated to Python 2.7.9
Convert FBX files to ASCII <-> BINARY in Python
Add a command to mark similar files together
Just add the python array to the json data
Summary of how to import files in Python 3
Add diagonal lines (hatch) to heatmap (python, matplotlib)
How to add a Python module search path
To add a module to python put in Julialang
How to get the files in the [Python] folder
Standard input summary
Speed: Add element to end of Python array
Batch conversion of Excel files to JSON [Python]
How to output "Ketsumaimo" as standard output in Python
Read wav files with only Python standard packages
[CentOS8] How to output Python standard output to systemd log
"Backport" to python 2
Create a simple API just to input and output JSON files ~ Python / Flask edition ~
Convert jupyter notebook .ipynb files to python executable .py files
Python practice Convert the input year to the Japanese calendar
[Python] [Django] How to use ChoiceField and how to add options
How to add help to HDA (with Python script bonus)
[Python] I want to merge Excel files anyway (pandas.merge)
Have python parse the json entered from the standard input
[Python] Local → Procedure for uploading files to S3 (boto3)
How to download files from Selenium in Python in Chrome
[Python] How to split and modularize files (simple, example)
Copy S3 files from Python to GCS using GSUtil
Convert MOL files to SMILES via standard I / O
Save lists, dictionaries and tuples to external files python
Which is better, python standard input receiving input () or sys.stdin?
How to read text by standard input or file name specification like cat in Python
Add convolution to MNIST
Key input in Python
How to install Python
Changes from Python 2 to Python 3.0
Rewrite Python2 code to Python3 (2to3)