Παρουσίαση με Ετικέτες

HowTo: Extract numeric suffix from a string in Python
24 Αυγούστου 20 11:15 πμ | Μπιρμπίλης Γεώργιος | 0 σχόλια   
I recently needed to extract a numeric suffix from a string value in Python. Initially I did the following: import re def extractNumSuffix(value):     return (None if (search:=re.search(‘^\D*(\d+)$’, value, re.IGNORECASE)) is None else search.group(1)) Note that return has a single-line expression. So print(extractNumSuffix("test1030")) prints 1030 Tried it online at: https://repl.it/languages/python3 However, then I found out […]
Δημοσίευση στην κατηγορία: , , , , , , , , , , ,
HowTo: Install Python, PIP and cx_Oracle on MSYS2 / Windows
23 Αυγούστου 20 03:12 μμ | Μπιρμπίλης Γεώργιος | 0 σχόλια   
Here’s how to install Python, PIP package installer and cx_Oracle extension module on MSYS2: $ pacman -S python warning: python-3.8.3-1 is up to date — reinstalling resolving dependencies… looking for conflicting packages… Packages (1) python-3.8.3-1 Total Installed Size:  108.66 MiB Net Upgrade Size:        0.00 MiB :: Proceed with installation? [Y/n] y … $ pacman -S […]
Δημοσίευση στην κατηγορία: , , , , , , , , , , , ,
Python rstrip and whitespace
10 Ιουλίου 20 04:10 πμ | Μπιρμπίλης Γεώργιος | 0 σχόλια   
Was just reading https://www.w3schools.com/python/ref_string_rstrip.asp which says The rstrip() method removes any trailing characters (characters at the end a string), space is the default trailing character to remove. Notes: 1) the chars param was added at Python 2.2.3, can’t use it at older versions as noted at https://docs.python.org/2.6/library/string.html string.rstrip(s[, chars]) Return a copy of the string […]
HowTo: make raw_input & input work the same in both Python 2 and 3
10 Ιουλίου 20 04:00 πμ | Μπιρμπίλης Γεώργιος | 0 σχόλια   
Was just trying to make a Python 2 script work in Python 3 and at first it seemed I just needed a small change to add missing parentheses to the argument of a couple of print statements. But then another issue came up, it wasn’t understanding the command raw_input(somePrompt) that was occuring at various places […]
Δημοσίευση στην κατηγορία: , , , , , , , , , , ,
Twitter #bot or not? Posing as Automation/AI specialist & Python guru
05 Ιουνίου 18 12:46 μμ | Μπιρμπίλης Γεώργιος | 0 σχόλια   
I just came across this strange thing on twitter: Received a notification that some “Virginia A. Osborn” liked a tweet of mine that was a) in Greek b) totally of a subset of Greek residents interest, highly unlikely it would have meant anything to a person with a foreign name. Then I saw that twitter […]
Δημοσίευση στην κατηγορία: , , , , , , ,

Search

Go

Ιστορικό Δημοσιεύσεων

Συνδρομές