Skip to content

python – storing lists as text and converting back again without separation issues

what I want is to read and write list of texts to a txt file without separation issues here’s a example from browsers if I search ‘cats dogs’, the link becomes ‘cats+dogs’ if I search ‘cats+dogs’, the link becomes ‘cats%2Bdogs’ if I search ‘cats%2Bdogs’, the link becomes ‘cats%252Bdogs’ it is little ahead of my skills rn (: Answer It looks

Can I somehow pick a specific number from a list?

I’m new at programming and i need help with my “work”. I need to print specific number from a list. List = from 1 to 10 000 and i need to pick every single number that has “375” as a last three digits For example: 375, 1375, 2375 etc. My english isn’t the best so I hope you undestood me

Bot unable to assign roles despite having the correct privileges

While developing a custom verification bot for one of my Discord servers I encountered a seemingly unfixable permission error. I am using the pycord rewrite fork (Pycord v2.3) and the exception I am encountering is: The issue is that even though I have invited my bot to my Discord server with administrative permissions it cannot edit/assign roles for applicable server

How to Create None Value into Python Pandas

Hello Guys How can i add “text” when the value is none? or maybe add NAN value… Answer I think you could use fillna() method to achieve your goal. It would look like that: Also there’s a function called isna(). You could use it like that:

Sharing instance of proxy object across processes results in pickle errors

I’m trying to implement a simple shared object system in python between several processes. I’m doing the following: However on Python 3.9, this keeps failing for various pickle errors, like _pickle.UnpicklingError: invalid load key, ‘x0a’. Am I doing something incorrect here? AFAIK it should be possible to read/write concurrently (several processes) from/to a Manager object (FYI I’ve created an issue

Rotate a line by a specific angle

I have a line with lenght of l and p1 and p2 and i want to rotate it by angle. I was using this matrix but it doesn’t work. matrix I have this code in python: Answer You first need to specify an origin point, the rotation will be created around that point. You can adapt your code and use

How to get parameter values out of json post

I am trying to use the bing maps api to get travel time and distance between 2 gps coordinates. I get a json answer, however, I am not able to get the values out of this dictionary ? gives the following result: now: how do I get the travelDistance out of this ? (14.511 in this case) or the travelDuration