Skip to content
Advertisement

Tag: python-3.x

Extract all matches unless string contains

I am using the re package’s re.findall to extract terms from strings. How can I make a regex to say capture these matches unless you see this substring (in this case the substring “fake”). I attempted this via a anchored look-ahead solution. Current Output: Desired Output I could accomplish this with an if/else but was wondering how to use a

VS Code cursor bug in terminal

Cursor repeating and remaining in the Integrated Terminal in VS Code I encountered this bug in my terminal while doing Python tutorial so downloaded and reinstalled the same version (latest version of VS Code) but the problem persists. I looked about for some answers but only found this tutorial which is not related. Anyway, I reinstalled the software only to

I cannot pass a parameter inside a function to another function (Python)

I successfully defined a parameter and passed it to a function but when I return to main menu that parameter’s value is completely reset and I cannot use it anywhere. The value of the parameter stays only within the second function. Like, the parameter cannot communicate with the whole program as far as I understand. For this project’s sake, I

Python 3: CSV Module

I am working with a simple csv file and want to know how to update the values contained in a specific cell on each row using data my script has generated. Then: Is there a way to take the list <new_colour> and write each list item into the values under colum3 within the csv file? To have it end up

Optimize conversion of numpy ndarray to string

I am currently doing a python program to convert from image to hex string and the other way around. I need two functions, one that takes an image and returns a hex string that corresponds to the RGB values of each pixel, and another function that takes a hex string, two ints, and generates a visible image of that size

Printing issues when moving from Python 2 to 3 with code

I have a code that I am trying to convert but it’s written in Python 2 and I would like to print this code in Python 3. However, it’s not able to print in matrix format. I am getting output in an unrecognizable table format. The code is following: The expected output is in the following format: Could you suggest

Advertisement