Questions tagged as 'python'

0
answers

how to edit netCDF file using python? generate another .nc only with a part of the original? [closed]

I am new with python and even more with netCDF. My situation is the next... I must download the .nc files generated by the ASCAT (wind information on the sea). Available at ftp://podaac-ftp.jpl.nasa.gov/allData / ascat / preview / L2 / metop_a...
asked by 19.05.2016 / 21:11
1
answer

Find values from a dictionary in a JSON and add them

I have 2 txt files. 1 is a dictionary with term, value and I have another file with a json that simulates a list of tweets. I have to look up the terms of the dictionary in the json and if it finds the term, add the value to a variable that I...
asked by 23.02.2018 / 13:48
3
answers

Compare 2 dictionaries in python to create another dictionary with matching keys

I am programming a development and I want to compare 2 dictionaries, which in common have keys of the same name. For example Dictionary 1 is of the form: dic1 = {'0': [2.4636363650000002], '6': [4.1666666650000002], '9': [4.833333334999...
asked by 20.07.2017 / 23:18
3
answers

How to invert individual words of a string with python?

I want to invert the string but I keep the word order and only invert the letters as for example, if I have    My dog Renzo I should get    iM orrep ozneR. But when I use [::-1] it gives me this result:    ozneR orrep iM...
asked by 07.09.2018 / 01:54
3
answers

Does anyone explain to me how this code works, to turn on and off a led?

Well this would be the code, unfortunately I'm just watching videos ... I do not have a raspberry, where I live so cheap they are not ... what confuses me here is the conditional While, it says while it's true ... in In any case, when I see that...
asked by 13.12.2017 / 16:25
2
answers

Help with Python cycle

Someone could explain to me the process that carries out the following line of code (see the image for more details). Specifically, this one: langs = [language for language in languages if language['name'] == name] I have already tried t...
asked by 29.07.2017 / 11:40
2
answers

Read certain elements in a string

Let's say that I have this string a='12345&&&4554444' as I do to read only the numbers of that string without having to do it with a cycle since the only way I know is going through the list. variable=str('') for i in a:...
asked by 17.03.2018 / 18:33
1
answer

Is there a way to distinguish the manual deletion of an object?

It is understood that distinguish it from the deletion made by the garbage collector. I would like the explicit deletion: del objeto It will execute something that does not run when the object disappears because the garbage collector detect...
asked by 17.01.2016 / 22:42
2
answers

How to return data correctly

I am new programming and I am in the challenge of making an incremental file backup. I have been based on the paradigm of object-oriented programming and I tried to work using the good practice "DRY" (Do not repeat yourself) to avoid repeatin...
asked by 02.01.2017 / 23:22
2
answers

Browse folders in python

I have the following code: import os, glob from obspy.core import read for fname in glob.glob('BC.*'): arch=fname.split('.') print "<==== ", fname # Quita la extension (.msd), si existe if(len(arch) > 7): del arc...
asked by 16.02.2016 / 18:55