Exemplo n.º 1
0
def find_dup_str(s, n):
    for index in range(len(s)-n+1):
        temp_string = s[index:index+n]
        updated_string = s[index+n:]
        if updated_string.find(temp_string) != -1 and len(updated_string) != 0:
            return temp_string
    return ""
Exemplo n.º 2
0
def find_max_dups(s):
    if len(s) > 1:
        for i in range(len(s)):
            if find_dup_str(s, i) != "":
                longest_dup = find_dup_str(s, i)
        return longest_dup
    else:
        return ""
def main():
    s = input()
    n1 = n2 = n3 = 0
    for i in range(0, len(s), 2):
        if s[i] == '1':
            n1 += 1
        elif s[i] == '2':
            n2 += 1
        else:
            n3 += 1
    ss = "1+" * n1 + "2+" * n2 + "3+" * n3
    print(ss[:-1])
Exemplo n.º 4
0
def prlist(arr):
    for idx,el in enumerate(arr):
        if(idx != len(arr)-1):
            print(el,end=",")
        else:
            print(el)
id_dict = {}

for row in top3blast
	if row[0] not in id_dict.keys()
		id_dict[row[0]] = 1

## Do for one-way blast
## Assuming blast hits are ordered from best to worst e-value
for key in id_dict()
	list = []
	for row in top3blast
		if row[0] = key
			list.append entire.row
	for rows from 0 to len(list)
		if len(list) == 1
			first = row[0]
			print row[0] to first_hits.tsv
		elif len(list) == 2
			first = row[0]
			print row[0] to first_hits.tsv
			second = row[1]
			print row[1] to second_hits.tsv
		else
			first = row[0]
			print row[0] to first_hits.tsv
			second = row[1]
			print row[1] to second_hits.tsv
			third = row[2]
			print row[2] to third_hits.tsv

## Do for reciprocal blast
Exemplo n.º 6
0
# # Create an Empty Series
# 
A basic series, which can be created is an Empty Series.
# In[1]:


#import the pandas library and aliasing as pd
import pandas as pd
import numpy as np
s = pd.Series()
print(s)


# # Create a Series from ndarray
# 
If data is an ndarray, then index passed must be of the same length. If no index is passed, then by default index will be range(n) where n is array length, i.e., [0,1,2,3…. range(len(array))-1].
# In[2]:


data = np.array(['a','b','c','d'])
s = pd.Series(data)
print (s)

We did not pass any index, so by default, it assigned the indexes ranging from 0 to len(data)-1, i.e., 0 to 3.
# In[3]:


data = np.array(['a','b','c','d'])
s = pd.Series(data,index=[100,101,102,103])
print (s)
Exemplo n.º 7
0
					Name.append(name.text)
				else:Name.append(np.nan)

				if name !=None:
					review.append(pno.text)
				else:review.append(np.nan)
				
				if add !=None:
					address.append(add.text)
				else:address.append(np.nan)
				
				if catt !=None:	
					cattagory.append(catt.text)
				else:cattagory.append(np.nan)

		except :
			#if some error occures then it will give some basic Recomendation to avoid That error
			print('some error occured.!')
			print('1) try to chenge the number of pages to scrowl "preffered number is 4"')
			print('2) check your internet connection')
			print('3) run the script agin')
			print('4) close all current chrome tabs')
			pass
							   
	creating an index list contaions the numbers from 1 to len of the data
	index=[];for i in range(1,len(Name)+1):index.append(i)
	
	#at last creating the DataFrame from the list
	df = pd.DataFrame({'index':index, 'Hotel Name':Name ,'Catogory':cattagory, 'number of reviews' :review,'address':address}) 
	df.to_csv('new_business.csv', index=False, encoding='utf-8')