Template of python script to read the contents of the file

readLine


import sys 
import os.path

argvs = sys.argv #Argument list
argc = len(argvs)

if (argc != 2):
    print 'args must to be 2' 
    quit()

if not (os.path.isfile(argvs[1])):
    print 'no such file: ' + argvs[1]
    quit()

f = open(argvs[1])

for line1 in f:
    #processing
f.close()



Recommended Posts

Template of python script to read the contents of the file
Read the xml file by referring to the Python tutorial
[Maya Python] Crush the contents of the script 2 ~ list Notes
Various ways to read the last line of a csv file in Python
[Bash] While read, pass the contents of the file to variables for each column
Easy encryption of file contents (Python)
How to switch the configuration file to be read by Python
[Maya Python] Crush the contents of the script 3 ~ List unknown Plugins
[Maya Python] Crush the contents of the script 1 ~ Camera Speed Editor
How to see the contents of the Jupyter notebook ipynb file
A Python script that compares the contents of two directories
Script python file
Process the contents of the file in order with a shell script
Python --Most elegant way to read lines of file into list
Script to change the description of fasta
Conditional branch due to the existence of a shell script file
Check the existence of the file with python
Create a shell script to run the python file multiple times
Read all the contents of proc / [pid] ~ From setgroups to wchan ~
Output the contents of ~ .xlsx in the folder to HTML with Python
Let's read the RINEX file with Python ①
Read all the contents of proc / [pid] ~ From cwd to loginuid ~
Read the file line by line in Python
Read all the contents of proc / [pid] ~ From map_files to numa_maps ~
Read the file line by line in Python
Read all the contents of proc / [pid] ~ From oom_adj to sessionid ~
The Python project template I think of.
Read all the contents of proc / [pid]
[Python] Get the character code of the file
[Python] Read the specified line in the file
Read all the contents of proc / [pid] ~ from attr to cpuset ~
[Python] A program that rotates the contents of the list to the left
[Python3] Understand the basics of file operations
[Introduction to Python] How to sort the contents of a list efficiently with list sort
[Python] How to read a csv file (read_csv method of pandas module)
Python script that outputs all records of Oracle table to CSV file
I made a program to check the size of a file in Python
Get the contents of git diff from python
How to read a CSV file with Python 2/3
[Python] Read the source code of Bottle Part 2
The contents of the Python tutorial (Chapter 5) are itemized.
The contents of the Python tutorial (Chapter 4) are itemized.
The contents of the Python tutorial (Chapter 2) are itemized.
The contents of the Python tutorial (Chapter 8) are itemized.
The contents of the Python tutorial (Chapter 1) are itemized.
[Python] How to read excel file with pandas
The contents of the Python tutorial (Chapter 10) are itemized.
[Python] Read the source code of Bottle Part 1
The contents of the Python tutorial (Chapter 6) are itemized.
Convert the character code of the file with Python3
The contents of the Python tutorial (Chapter 3) are itemized.
Get the update date of the Python memo file.
the zen of Python
Read Python csv file
[Python] Scan the inside of the folder including subfolders → Export the file list to CSV
Python script to get a list of input examples for the AtCoder contest
I made a script to record the active window using win32gui of Python
Easy way to check the source of Python modules
python beginners tried to predict the number of criminals
The wall of changing the Django service from Python 2.7 to Python 3
How to get the number of digits in Python