Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python data structures 9.4

name = input("Enter file:")
if len(name) < 1 : name = "mbox-short.txt"
handle = open(name)
count = 0
for i in handle:
    if i.startswith("From "):
        a = i.split()
        b = a[1]
        if b.startswith("cwen"):
            count+= 1
            if count == 5:
                print(b,count)
Comment

PREVIOUS NEXT
Code Example
Python :: exit python terminal 
Python :: how to run cmd line commands in python 
Python :: Sorting Dataframes by Column Python Pandas 
Python :: drop every other column pandas 
Python :: magic methods python 
Python :: python Correlation matrix of features 
Python :: convert datetime to date python 
Python :: How to perform Bubble sort in Python? 
Python :: check pyenv version windows 
Python :: numpy as array 
Python :: numpy stack arrays vertically 
Python :: biggest of 3 numbers in python 
Python :: appending to a file in python 
Python :: convert a dictionary to pandas dataframe 
Python :: python convert string to bytes 
Python :: inverse list python 
Python :: flask-callable 
Python :: how to create model in tensorflow 
Python :: secondary y axis matplotlib 
Python :: python remove everything after character 
Python :: sort a list of array python 
Python :: print current line number python 
Python :: bash python csv to json 
Python :: create django group 
Python :: remove last line of text file python 
Python :: python soup 
Python :: pyspark dropna in one column 
Python :: python return specific elements from list 
Python :: clicking a button in selenium python 
Python :: how to display printed values without scientific notation python 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =