Get Attribute
title: "Get Attribute"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
print(getattr(sys, 'version'))
3.6.8 |Anaconda, Inc.| (default, Dec 29 2018, 19:04:46)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
Score: 0
Read More
Get Full Matches
title: "Get Full Matches"
author: "Raja CSP Raman"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
import re
from typing import List
_RGX = re.compile(r'(.)\1*')
def long_repeat(string: str) -> List[str]:
return [m.group(0) for m in _RGX.finditer(string)]
print(long_repeat('devvvvveeeeeeeeeeeloooooooooper'))
['d', 'e', 'vvvvv', 'eeeeeeeeeee', 'l …
Read More
Get Int Input
title: "Get Int Input"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
print((x+y))
Enter a number: one
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-d1355a0ae898> in <module>()
----> 1 x = int(input …
Read More
Get-Value-And-Check-1
DATA = "data"
JSON_DATA = "jsonData"
PENALIZATION_IMPUTATION_WEIGHTAGE = "penalizationImputationWeightage"
mltrainconfig_json = {
"data" : {
"jsonData" : {
"penalizationImputationWeightage" : {
"one" : "two"
}
}
}
}
penalization_imputation_weightage = mltrainconfig_json.get(DATA, {})\
.get(JSON_DATA, {})\
.get(PENALIZATION_IMPUTATION_WEIGHTAGE, {})
penalization_imputation_weightage = penalization_imputation_weightage if penalization_imputation_weightage else imputing_factor_value
penalization_imputation_weightage
mltrainconfig_json = {
"data" : {
"jsonData" : {
"penalizationImputationWeightage2" : {
"one" : "two"
}
}
}
}
imputing_factor_value = {
"eleven" : "twelve"
}
penalization_imputation_weightage = mltrainconfig_json.get(DATA, {})\
.get(JSON_DATA, {})\
.get(PENALIZATION_IMPUTATION_WEIGHTAGE, {})
penalization_imputation_weightage
penalization_imputation_weightage = penalization_imputation_weightage if …
Read More
Github-Language-Finder
title: "GitHub Language Finder"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
import requests
from bs4 import BeautifulSoup
# Collect and parse first page
page = requests.get('https://github.com/getify/BikechainJS')
soup = BeautifulSoup(page.text, 'html.parser')
#print(soup)
summary_element = soup.select("div.overall-summary")
#print(summary_element)
commits …
Read More