text
stringlengths
226
34.5k
How to load a MATLAB file which has 2 arrays, in 1 code of line Question: I have 1 file with 2 arrays inside it (x and y). This is the dictionary keys: dict_keys(['__version__', 'x', '__header__', 'y', '__globals__']) These are the instructions I write to call my arrays without the dict_keys: ...
When I write to a text file in python 3.5.1 the text file is blank Question: I'm writing to a text file but the final content is blank. Can anyone help. def main(): types = input('What is the device type? Phone or Tablet') save = open('type.txt', 'w') save.write(types) sav...
Coinbase Wallet API python Authentication Error, Invalid Signature Question: Python 3.4 Coinbase Wallet API V2 * * * I have been stuck for some time trying to figure out while this buy call (and other api calls like get_payment_methods() and get_accounts() ) run into authentication errors. I have successfully been ab...
Remove backslash with str.translate Question: I wrote the following Python2.7 code to remove digits and the backslash character (\\) from some string. I attempted to use the str.translate method, because I had learned that it is very efficient. The code below successfully removed digits from the string x, but is unable...
Spyder crashes at start: UnicodeDecodeError Question: During a Spyder session my Linux froze. After startup, I could not start Spyder; I got the following error instead: (trusty)dreamer@localhost:~$ spyder Traceback (most recent call last): File "/home/dreamer/anaconda2/bin/spyder", line 2, in ...
Why does print() print an empty tuple instead of a newline? Question: **The error was caused by a typo. Please flag this question as off-topic.** I am having a little issue with the following lines. from __future__ import print_function print() If I open up my Windows CLI and run it, it runs a...
Python, copy only directories Question: I have a program that has a list of some files. I have to copy only the directories and the subdirectories from the list to a specified directories and don't need to copy the files. I tried this, but it doesn't work. def copiarDirs(): items = list.curselection(...
sending mails with different domain names in python Question: I'm getting "SMTP AUTH extension not supported by server" while sending mails with different domain names. For example, I have sent mails using person@example.com. Here my domain is example.com. when I trying send mail I am getting "SMTP AUTH extension not ...
Split String with unicode and backslash with Python Question: I am experiencing trouble extracting a float from a string. The string is the output of webscraping: input = u'<strong class="ad-price txt-xlarge txt-emphasis " itemprop="price">\r\n\xa3450.00pw</strong>' I want to get: `output: 3450.00...
Unable to add network printer using python Question: I am very new to python and trying to execute printer installation using python but it doesn't work. If I execute the same using cmd, it works. import os os.system("rundll32 printui.dll PrintUIEntry /in /n \\print-kunnu.com\FollowYou") When I...
How to list HDFS directory contents using webhdfs? Question: Is it possible to check to contents of a directory in HDFS using `webhdfs`? This would work as `hdfs dfs -ls` normally would, but instead using `webhdfs`. How do I list a `webhdfs` directory using Python 2.6 to do so? Answer: You can use the `LISTSTATUS` ...
End of script output before headers: wsgi.py Question: I am trying to install my django project with Apache, mod_wsgi and python3. but Apache still gives this error: Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'> Traceback (most recent call last): File "/us...
Web Scraping with Python - Selecting div, h2 and h3 class Question: This is my first time with Python and web scraping. Have been looking around and still unable to get what I need to do. Below are print screen of the elements that I've used via Chrome. What I am trying to do is that, I am trying to get the apartment...
Python script runs perfect in PyCharm but in terminal don't Question: I really don't understand... If you need screenshots of some settings please tell me because I really don't know why it works in PyCharm but not outside Pycharm... from selenium import webdriver from selenium.webdriver.support.ui i...
gsutil acl set command AccessDeniedException: 403 Forbidden Question: I am following the steps of setting up Django on Google App Engine, and since Gunicorn does not serve static files, I have to store my static files to Google Cloud Storage. I am at the line with "Create a Cloud Storage bucket and make it publically ...
Python ftp.retrbinary() does not work when called parallelized in function Question: I am using a script to retrieve data from a ftp-server. As I want to parallelize the download, `ftp.retrbinary` is called within a function. Atm the working code looks like this: from ftplib import FTP def down...
How do I lazy evaluate variables in a python eval expression Question: The scenario is that my user can supply an expression string for evaluation. It could be: "power=(x**2+y**2)**0.5" Then I get an input stream of data with labels. E.g.: x ; y ; z 1 ; 2 ; 3 1 ; 3 ; 4 ...
Python: Accessing a particular cell in a data frame, change it, then save into a new version of the data frame Question: Using Pandas, I have a data frame with a column containing a string that I am splitting when a ; or , is seen: import re re.split(';|,',x) I want to iterate through the colum...
python gettext: specify locale in _() Question: I am looking fo a way to set the language on the fly when requesting a translation for a string in gettext. I'll explain why : I have a multithreaded bot that respond to users by text on multiple servers, thus needing to reply in different languages. The [documentation](...
Create new columns based on multiple conditions in Python Question: I have the following dataframe: data = [ (27450, 27450, 29420,"10/10/2016"), (29420 , 36142, 29420, "10/10/2016"), (11 , 11, 27450, "10/10/2016")] #Create DataFrame base df = pd.DataFrame(data, columns=("User_...
Can't connect to local Machine IP through TCP From Arduino Uno using SIM900 Shield Question: So you have a basic understanding of the parts im using, I have: * Arduino Uno * Seeed Studio GPRS Shield v2.0 (<http://www.seeedstudio.com/wiki/GPRS_Shield_V2.0>) * Ultimate GPS for Adafruit V3.3 (<https://www.adafrui...
Django - aggregate queryset by week of year Question: I have model looking like this: class TestData(models.Model): name = models.CharField(max_length=255) one_value = models.IntegerField() second_value = models.IntegerField() create_at = models.DateTimeField() Is an...
Python (pygame) using the sprites and classes to make clones of images Question: import pygame import time import random #Loads pygame and clock and random function pygame.init() #Intiates pygame display_width = 1440 display_height = 900 gameDisplay = pygame.display.set_mode(...
HandlerSSHTunnelForwarderError with SSHTunnelForwarder Question: I am trying to connect to my remote postgres db as follows: from sshtunnel import SSHTunnelForwarder #Run pip install sshtunnel from sqlalchemy.orm import sessionmaker #Run pip install sqlalchemy with SSHTunnelForwarder( ...
Why can't I see all stats for object from Facebook Graph API Question: I'm using the [Python SDK for Facebook's Graph API](https://github.com/mobolic/facebook-sdk) to fetch how many times a Facebook page has been liked. I went to the [API Explorer](https://developers.facebook.com/tools/explorer/) to obtain an access to...
python - how to write empty tree node as empty string to xml file Question: I want to remove elements of a certain tag value and then write out the `.xml` file WITHOUT any tags for those deleted elements; is my only option to create a new tree? There are two options to remove/delete an element: > > [clear()](https://...
How to increment a variable contained within a class in python from outside of its class? Question: I have a fairly simple python question, as I am pretty new to the language. I started writing a quick program just for practice, but have now become frustrated because I cannot get it to work. import rando...
Can't find a constant-time module in cryptography package used on AWS Lambda Question: _[I am new to Python 2.7 and AWS Lambda, any help is appreciated]_ I followed the [AWS Lambda tutorial](https://aws.amazon.com/blogs/compute/scheduling-ssh-jobs-using-aws- lambda/) and created a virtualenv to include Python libs ass...
ImportError: cannot import name corpora with Gensim Question: I have installed Anacoda Python v2.7 and Gensim v 0.13.0 I am using Spyder as IDE I have the following simple code: from gensim import corpora * * * I got the following error: from gensim import corpora File...
Unable to read HTML content Question: I'm building a webCrawler which needs to read links inside a webpage. For which I'm using urllib2 library of python to open and read the websites. I found a website where I'm unable to fetch any data. The URL is "<http://www.biography.com/people/michael-jordan-9358066>" My code, ...
Haar- Cascade face detection OpenCv Question: I used the following code to detect a face using Haar cascade classifiers provided by OpenCv Python. But the faces are not detected and the square around the face is not drawn. How to solve this? import cv2 index=raw_input("Enter the index No. : ") ...
Python translating C saxpy Question: This is the C code: btemp = (*beta)/(*beta_prev); for (k=0; k<xsize*ysize; k++) { parray[k] = zarray[k] + btemp*parray[k]; } And I am doing the following in Python: def saxpy(a, x, y): return np.array([a * xi + yi for xi, yi ...
python replace not working Question: I am trying to do multiple replaces in python but the replace is not working, it only replaces the `<UNK>` but not `</s>`. Can anybody tell me where the error is? text=text.replace(":<UNK>","") text=text.replace("</s>","") Answer: Your code worked correctly...
Using type hints to translate Python to Cython Question: Type Hints now are available in Python 3.5 version. In the specification ([PEP 484](https://www.python.org/dev/peps/pep-0484/)) the goals (and the non-goals) are exposed clearly: > # Rationale and Goals > >> This PEP aims to provide a standard syntax for type a...
Python anywhere modules not accessible outside main directory Question: In my attempts to create a web app with python anywhere I have discovered that my preferred module web.py is not preinstalled like other modules such as flask. Upon looking through some forums I came to the understanding that installation would occ...
Accessing website with urllib returns error, retrieving information from Results Page Question: Hello I created a code in python so I could access a reverse phone lookup site and determine if a phone is a cell phone or land line. The website I am using is whitepages, whose results page will only include the phrase "VoI...
Python: many-to-many comparison to find required set of data Question: This is my first question so please forgive any mistakes. I have a large file(csv) with several(~10000000+) lines of information like the following example: date;box_id;box_length;box_width;box_height;weight;type --snip-- 199...
PyQt5 app exits on error where PyQt4 app would not Question: I have been developing a scientific application using PyQt4 for a couple of weeks, and decided to switch over to PyQt5. Aside from a few things to iron out one thing is puzzling me, and I'm not sure if its intended behavior or not. When Using PyQt4: if I had...
Buildozer android APK Import Error Question: Please help. My kivy program runs perfect on the desktop (Mac OS, using buildozer and Android-new toolchain). However once i build the APK and test it on the android Emulator (Andyroid) i get the following error in the logcat regarding the user class that i import. Do i ne...
Open links from txt file in python Question: I would like to ask for help with a rss program. What I'm doing is collecting sites which are containing relevant information for my project and than check if they have rss feeds. The links are stored in a txt file(one link on each line). So I have a txt file with full of ba...
how to remove the delay in obtaining data from the Arduino via COM? Question: I have an Arduino connected to the joystick. Arduino sends the data via COM port to my PC. On PC, the data processed by the program in Python, in which the circle moving with joystick. The fact is that after a few minutes there is a delay bet...
Publish python project with imported modules Question: I would like to publish a python project, but i use modules in it like socket. How do i add to the project code that is not mine? Is that even legal? Answer: There's no need to add modules that are in the standard library. For other dependencies, you can * tes...
Django Error - ImportError: cannot import name get_cache Question: I was running my project using Django 1.8 and it was working properly. But then I had to upgrade Django to 1.9 now when I again run my project it gave an error - ImportError: cannot import name get_cache. python manage.py syncdb and...
JSON to data frame after some calculations python Question: I have a JSON file { "b0:47:bf:af:c1:42": { "No. of visits": 10, "cities": { "Mumbai": {"count": 5,"last_visited": "5/22/2016"}, "Kolkata": {"count": 2,"last_visited": "5/22/2...
Changing a variable in a list does not affect the list Question: I've been attempting to write some code to tune variables in my chess program, and I found that this code doesn't do what I expect it to do at all. import random # Knight value, bishop value, rook value, queen value values = [3...
Python Saving long string in text file Question: I have a long string that I want to save in a text file with the code: `taxtfile.write(a)` but because the string is too long, the saved file prints as: "something something ..... something something" how do I make sure it will save the entire s...
I cant figure out the read part of the Python program. Please assist Question: Write: def main(): import random #Open a file named numbers.txt. myfile = open('numbers.txt', 'w') file_size= random.randint(4,7) #Produce the numbers fo...
Scrape special characters in Python Beautiful Soup Question: How can I remove (or encode) the special characters from the page referenced below? import urllib2 from bs4 import BeautifulSoup import re link = "https://www.sec.gov/Archives/edgar/data/4281/000119312513062916/R2.htm" ...
Scraping Instagram followers page using selenium and python Question: I have a question related to scraping the instagram followers page. I have a code but it displays only 9 followers. Kindly help me. from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdri...
Python ignoring while loop with True condition Question: I'm writing a menu for a simple game, so I thought to use a while loop to let the user choose his wanted option by clicking on it. While my program works properly until this loop, it does not continue when reaching the line of the following loop: p...
Log all save/update/delete actions in all django models Question: There are several models in my django app. Some of them derive from models.Model, some - from django-hvad's translatable model. I want to log every save/delete/update operation on them. I am aware of standard django logger of admin actions, but they are ...
GAE Python - OperationalError: (2013, 'Lost connection to MySQL server during query') Question: I've been trying to connect to ClouSQL using Flexible Environments (vm:true) but when I upload my app using: gcloud preview app deploy --version MYVERSION An error is thrown: OperationalE...
specific Regular expression search python Question: This is my first post. I always come to this forum looking for an answer when it comes to code. I have been fighting with understanding regular expressions in Python, but it is kind of hard. I have text that looks like this: Name: Clash1 Distanc...
statsmodels: What are the allowable formats to give to result.predict() for out-of-sample prediction using formula Question: I am trying to use `statsmodels` in python to impute some values in a Pandas `DataFrame`. The third and fourth attempts below (df2 and df3) give an error `*** AttributeError: 'DataFrame' object ...
How to delete alphanumeric words out of a Unicode file Question: I need to use a dictionary database, but most of it is some alphanumeric useless stuff, and the interesting fields are either non alphanumeric (such as chinese characters) or inside some brackets. I searched a lot, learned about a lot of tools like sed, a...
Google Vision API text detection Python example uses project: "google.com:cloudsdktool" and not my own project Question: I am working on the python example for Cloud Vision API from [github repo](https://github.com/GoogleCloudPlatform/cloud- vision/tree/master/python/text). I have already setup the project and activat...
OpenCV grabcut() background color and Contour in Python Question: I am using Python and OpenCV. I am now using `grabcut()` to crop out the object I want. Here is my code: img = cv2.imread('test.jpg') img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) mask = np.zeros(img.shape[:2], np.uint8) bgdM...
Why is my Spark DataFrame much slower than RDD? Question: I have a very simple Spark DataFrame, and when running a DataFrame groupby, the performance is terrible - about 8x slower than the (in my head) equivalent RDD reduceByKey... My cached DF is just two columns, customer and name with only 50k rows: ...
python: filter a list of strings based on a string name Question: I have a lists of strings that look like this: li1 = ['pin 2.3','vlo 5.4', 'lu 1.3', '3 packages installed', '', 'bla'] l12 = ['pin 2.3','vlo 5.4', '2 packages installed', 'bla', 'bla'] I want to filter out from the lists th...
Scrapy and Pycharm - Stange import error - No module named [insert name of scrapyproject here] Question: Hi Stackoverflow Community I encountered the following issue. I have a scrapy project which I added to my project: -.idea -associate -core -scrapyproject -- scrapyproject_one ...
python float to string without precision loss Question: For python 3 I want to convert a float to a string, with possibly different length (i.e. number of digits) but with full precision. Also I need to have a decimal point in any case: 1 -> '1.' 1/10 -> '0.100000000000000005551115123125782702118...
InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape [1000,625] Question: I get the above unexpected error when trying to run this code: # -*- coding: utf-8 -*- """ Created on Fri Jun 24 10:38:04 2016 @author: andrea """ ...
result of coupled ODE in python code is different from mathematica Question: As per my language knowledge my code is written correct. But It is not giving me correct solution (plot). When I had solved same system of ODE's in mathematica, I have correct solution and both solutions are totally different. I am writing a r...
How to write the data of 3 dictionaries in a table separated by tab into a text file? Question: Say I have the following 3 dictionaries: d1 = {'Ben': {'Skill': 'true', 'Magic': 'false'}, 'Tom': {'Skill': 'true', 'Magic': 'true'}} d2 = {'Ben': {'Strength': 'wo_mana', 'Int': 'wi_mana', 'Speed': 'wo_man...
How does Perl avoid shebang loops? Question: `perl` interprets the shebang itself and mimics the behavior of `exec*(2)`. I think it emulates the Linux behavior of splitting on all whitespace instead of BSD first-whitespace-only thing, but never mind that. Just as a quick demonstration `really_python.pl` ...
Training a simple net doesn't appear to change values of variables more than once Question: I'm sure I'm missing something obvious. Here's the tail end of my code: # simple loss function loss = tf.reduce_sum(tf.abs(tf.sub(x4, yn))) train_step = tf.train.GradientDescentOptimizer(0.000001).min...
Equivalent code in python (time) Question: Javascript code: var date = new Date(1466278504960); return: Sat Jun 18 2016 20:35:04 GMT+0100 (WEST) How can I convert the same number to date in python ? When I use datetime.datetime.fromtimestamp(int("1466278504960")).strftime('%Y-%m-%d...
Running phantomjs on linux using python Question: I followed [this link](http://stackoverflow.com/questions/8778513/how-can-i- setup-run-phantomjs-on-ubuntu) and now when I type `phan` and then tab (`\t`) it does autocomplete to phantomJS. Yet if I run `phantomJS -v` or `phantomJS --version` I get: bash...
How to import GstPbutils? Question: I'm trying to use the GstPbutils python3 module, but just importing it breaks everything, here is the code: #!/usr/bin/python3 import gi gi.require_version('GstPbutils', '1.0') from gi.repository import GstPbutils print('Hello World!') A...
How can I convert a string sent over UART to integer in python? Question: I'm having difficulty converting a string I'm receiving over UART to the decimal version of it. I read in one byte with `port.read(1)` then print it print "%s: %s" % ( time.ctime(time.time()), str) This prints out the expecte...
deleting a file after uploading to s3 in python Question: def upload(s): conn=tinys3.Connection("AKIAJPOZEBO47FJYS3OA","04IZL8X9wlzBB5LkLlZD5GI/",tls=True) f = open(s,'rb') z=str(datetime.datetime.now().date()) x=z+'/'+s conn.upload(x,f,'crawling1') os.remove(s...
Iterate through JSON [Python] Question: I am reading the following JSON file in python: { "name": "Property", "base": "PersistedModel", "idInjection": true, "options": { "validateUpsert": true }, "properties": { "uuid": { "type": "string" ...
Parse POST HTTP response using Python Question: i want to parse a POST HTTP response using python. My response looks like: { "Result": 0, "ResponseStatus": { "ErrorCode": null, "Message": null, "StackTrace": null, "Errors": null }, "SessionId": "68...
Python MySQLdb - Connection in a class Question: I am making a Python project where I have to seek and retreive data from a database. I tried making a class, in which I declare the connection and do my queries, here is moreless what I have so far. import MySQLdb dbc =("localhost","root","1234","use...
Scrapy Xpath output empty Question: I would like extract data on this website : <http://www.pokepedia.fr/Pikachu> I'm learning the python and how to use Scrapy and my problem is : Why I can't retrieve the data with Xpath ? My Xpath look good when i test xpath in my browser, it return me the correct value. (Google Chro...
How to increase the model accuracy of logistic regression in Scikit python? Question: I am trying to predict the admit variable with predictors such as gre,gpa and ranks.But the prediction accuracy is very less(0.66).The dataset is given below. <https://gist.github.com/abyalias/3de80ab7fb93dcecc565cee21bd9501a> Please...
python-social-auth with Django: ImportError: No module named 'openid.association' Question: I am trying to use `python-social-auth` with Django 1.9 and Python 3. As far as I can tell, I have installed all the necessary requirements, and have all the required settings in my `settings.py`. However, when I try to run migr...
How can I disable ExtDeprecationWarning for external libs in flask Question: When I run my script, I get this output: /app/venv/lib/python2.7/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.sqlalchemy is deprecated, use flask_sqlalchemy instead. .format(x=modname), Ext...
Sort JSON dictionaries using datetime format not consistent Question: I have JSON file (post responses from an API) - I need to sort the dictionaries by a certain key in order to parse the JSON file in chronological order. After studying the data, I can sort it by the date format in metadata or by the number sequences ...
Flask-edits: AttributeError: 'TokenStream' object has no attribute 'next' Question: I am trying to test the flask-edits package (<https://github.com/nathancahill/Flask-Edits>) Can anyone help with this error: AttributeError: 'TokenStream' object has no attribute 'next' @app.route('/') def hello_...
Issue with requests module in python for AWS Lambda Question: I am writing a lambda function with an intent that uses requests to pull information from a _Wolfram_ CloudObject. Here is the relevant part of the code: from __future__ import print_function import requests . . . ...
How to customize pybusyinfo window in (windows OS) to make it appear at top corner of window and the other formatting options? Question: I am writing a python script to get the climate conditions in particular area every 30 minutes and give a popup notification. This code gives popup at the center of the screen which ...
Cannot run pyspark in Jupyter Question: I have Windows 10 and have installed spark following the instructions from: <https://hernandezpaul.wordpress.com/2016/01/24/apache-spark-installation-on- windows-10/> Now I open my jupyter notebook, and type the following: import os import sys # Path...
How to keep trying to establish connection in Python Question: If the server is not up when I try to run the following code, I just get a Connection refused error. How can I make the sender below to keep trying to establish connection and perhaps sending until the remote server is indeed up and the connection is succe...
Converting Google Analytics Reporting API V4 request results to csv with Python Question: I'm trying to create a nicely formatted csv file with Python from a Google Analytics Reporting API V4 request results. The setup is using the provided example "Hello Analytics Reporting API V4." <https://developers.google.com/ana...
Python Removing Columns Question: I am trying to remove the last two columns from my data frame by using Python. The issue is there are cells with values in the last two columns that we don't need, and those columns don't have headers. Here's the code I wrote, but I'm really new to Python, and don't know how to take ...
Installing opencv in python Question: I'm having some trouble installing OpenCV. I have been using Anaconda, and I copied the `cv2.pyd` file into the `...\Lib\site-packages` folder. When I get type `import cv2` into Python I get this error: `Traceback (most recent call last): File "<stdin>", line 1...
Python quit unexpectedly, Segmentation fault: 11 Question: I have installed python 2.7.12. I used "pip install pulp" to install pulp package. My problem is that "import pulp" gives me the following error. How can I solve this problem. Let me know if you need something else to debug. I have a Mackbook pro with El Capita...
using import inside class Question: I am completely new to the python class concept. After searching for a solution for some days, I hope I will get help here: I want a python class where I import a function and use it there. The main code should be able to call the function from the class. for that I have two files i...
Detecting ordered iterables (sequences) in python Question: I am attempting to build a function that takes an iterable and returns a tuple, provided that the iterable will always be iterated over in a canonical way. For example, if the input iterable is `list` or `tuple`-like, I want to accept the input, but not if it ...
pylint, coroutines, decorators and type inferencing Question: I'm working on a Google AppEngine project and I recently upgraded my pylint version to: No config file found, using default configuration pylint 1.5.6, astroid 1.4.6 Python 2.7.10 (default, Oct 23 2015, 19:19:21) This seems ...
Python: Simple Web Crawler using BeautifulSoup4 Question: I have been following TheNewBoston's Python 3.4 tutorials that use Pycharm, and am currently on the tutorial on how to create a web crawler. I Simply want to download all of XKCD's Comics. Using the archive that seemed very easy. Here is [my code](http://pastebi...
Merge a list of pandas dataframes Question: There has been many similar questions but none specifically to this. I have a list of data frames and I need to merge them together using a unique column `(date)`. Field names are different so concat is out. I can manually use `df[0].merge(df[1],on='Date').merge(df[3],on='D...
How to delete entire row of data set given a condition on a column in csv file? Question: Here is a snippet of the following data-set in csv format: quantity revenue time_x transaction_id user_id 1 0 57:57.0 0 0 0 1 0 18:59.0 0 1 ...
My spark app is too slow, how can I increase the speed significantly? Question: This is part of my spark code which is very slow. By slow I mean for 70 Million data rows it takes almost 7 minutes to run the code but I need it to run in under 5 seconds if possible. I have a cluster with 5 spark nodes with 80 cores and 1...
selecting multiple ROI in an image Question: hey guys i am using opencv 2.4 with python 2.7 on ubuntu14.04 I want to select multiple Region of Interest in an image is it possible to do so. I want to do motion detection in only the area i have selected to do so any of the following theory can solve my problem but don'...
Sort a nested dictionary in Python Question: I have the following dictionary. var = a = { 'Black': { 'grams': 1906, 'price': 2.05}, 'Blue': { 'grams': 9526, 'price': 22.88}, 'Gold': { 'grams': 194, 'price': 8.24}, 'Magenta': { 'grams': 6035, 'price': 56.69}, 'Maroon': { 'gr...
TwitterAPI for Python: using result from request in a new request Question: I want to collect all user data from the followers from a specific twitter user. First, I collect the user_id's of the followers from the user using followers/id. Thereafter I want to use users/lookup in order to collect the user data from the ...
Python 3.5:Not able to remove non alpha -numeric characters from file_name Question: i have written a python script to rename all the files present in a folder by removing all the numbers from the file name but this doesn't work . Note :Same code works fine for python2.7 import os def rename_fil...
Python open FTP url and write to file Question: How can I open and FTP url and download it into a file. What I'm trying looks something like this: from contextlib import closing from urllib.request import urlopen url = 'ftp://whatever.com/file.txt' target_path = 'file.txt' with ...