This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count_digit(n): | |
c = 0 | |
for i in range(0, n+1): #For to parse from 0 to given n | |
for digit in str(i): #For to parse given n's digits | |
if digit == '9': #Digit's occurence which will be counted | |
c = c + 1 | |
return c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_if_string_in_file(file_name, string_to_search): | |
""" Check if any line in the file contains given string """ | |
# Open the file in read only mode | |
a = False | |
with open(file_name, 'r') as read_obj: | |
# Read all lines in the file one by one | |
for line in read_obj: | |
# For each line, check if line contains the string | |
if string_to_search in line: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gi | |
import sys | |
gi.require_version('Gst', '1.0') | |
from gi.repository import Gst | |
Gst.init(None) | |
appsrc = Gst.ElementFactory.make("appsrc", "appsrc") | |
filesink = Gst.ElementFactory.make("filesink", "filesink") | |
filesink.set_property("location", "test.dat") |