If I have a list and I basically want to count the amount of items in the list but only start after the leading zeroes, how would I do that? Keep in mind that I want to count the zero in the middle of the list but not the ones at the beginning. I’ve tried this: But it didn’t get
Tag: python
Rotate image for data augmentation using tf keras only in specific angles
In tf keras, it is possible to have a data augmentation layer that performs rotation on each given image during training, in the following way as the docs say: The factor argument indicates the value of maximum rotation if a float is given and indicates lower and upper limits if a tuple is given. For my speci…
How can I make sue only I can use certain commands on my Discord bot? (Python)
So my Discord bot can now kick people from my server. But right now everyone can use the kick command. And I don’t want that. How can I fix this? This is the code so far: Thanks in advance! Answer I have done that before, this answer may help. First, import the necessary modules first I assume you alrea…
How do I change the colour of my QR code?
I want to make a QR code with python. The output is a white background with a black qr code. How do I change both of them? Answer pyqrcode module has not been updated for over 5 years. Use qrcode module instead. Note that qrcode module requires Pillow module. Note that I pass the photo and subject to showcode…
Vectorized way to construct a block Hankel matrix in numpy (or scipy)
I want to contrsuct the following matrix : where each v(k) is a (ndarray) vector, say from a matrix Using a for loop, I can do something like this for example: And I get : Is there any way to construct this matrix in a vectorized way (which I imagine would be faster than for loops when it comes to
How to automatically display a specific range of columns on a spreadsheet created with xlsxwriter?
I would like to automatically display a specific range of columns when opening an excel spreadsheet created with xlsxwriter. This is illustrated in the example below where the first row and column are frozen while the range of columns being displayed start at E and not at B (but note that I don’t want B…
How to create Azure Virtual machine with VM Extension using the python SDK
I want to create an Azure virtual machine with the VM extension(Custom script extension) using the python SDK. Basically, I want a python program that will create the VM with VM extension using the Azure SDK management libraries, I am able to use the Azure SDK management libraries in a Python script to create…
How to stack multi-line labels vertically in BoxLayout
I am trying to create a stack of multiline Labels on Kivy inside a BoxLayout. How do I get the BoxLayout to expand according to its contents? Now the BoxLayout is squeezing the Labels instead. I do not wish to hardcode the multiline Label size as I want each to be flexible to accommodate varying lines of text…
How can I get a Url that include Path of a Json File instead of Passing the Locally Path Using Firebase
Is there any way to upload the Credential File to the Firebase and only pass a path for this file from firebase to authenticate. For Example: here I need to pass the credential file which is in my local computer I need to pass a path from the internet maybe by uploading the credential file “serviceAccou…
Advanced string manipulation in Python
I’m trying to get only the value that are after the string 2021 from the following string: I need to get those 2 values separated (first one has to be 168088000000 and the second one has to be 61271000000 in this case). They have to be preceded by 2021 (and the result should give only the 2 numbers I me…