Skip to content

Tag: python

Can I run Jupyter notebook cells in commandline?

I am deploying a Python package, and I would like to run a simple test to see if all cells in my notebook will run without errors. I would like to test this via commandline as I have issues running a notebook in virtualenv. Is there are simple command-line way to test this? Note to the moderator: this questio…

How to update JIRA issue reporter from Python

I’m trying to update the reporter of an issue using the JIRA Python API (version 1.0.3). I am signed in (using basic auth) as a user who has full permissions, and I am trying to do it for an issue which I myself have created. The issue is successfully created, however when I call the update command, it …

How to use Python to convert an octal to a decimal

I had this little homework assignment and I needed to convert decimal to octal and then octal to decimal. I did the first part and could not figure out the second to save my life. The first part went like this: I read how to convert it here: Octal to Decimal, but I have no clue how to turn it

Why doesn’t contextmanager reraise exception?

I want to replace class’s __enter__/__exit__ functions with single function decorated as contextlib.contextmanager, here’s code: When we got exception inside Test’s __exit__, we pass it to _cm’s __exit__, it works fine, I see exception inside _cm. But then, when I decide to reraise ins…

Extract digits from string by condition

I want to extract digits from a short string, base on a condition that the digits is in front of a character (S flag). example and result: I can split the string to a list to get the individual element, but how could I just get the 18 and 10? Answer Use re.findall with the regex r'(d+)S’. This matches a…