text
stringlengths
226
34.5k
why can't import pandas after installed successfully? Question: I have installed pandas with command 'pip3.4 install pandas'. Successfully installed pandas python-dateutil pytz numpy six Cleaning up... root@hwy:~# python3.4 Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] o...
error importing QtGui from Pyside Question: I just downloaded and installed PySide and I am getting this error when I try to import QtGui from PySide $ python -c "from PySide import QtGui" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: dlopen(/Library/P...
Project "Gothonweb" in Learn Python the Hard Way ex50 works fine on Ubuntu, fails on win7 Question: I did the project in ex50. It works fine on ubuntu. However I can't get it run normally on win7. What's wrong with it? (My code is exactly the same as what it is in the book!) app.py import web urls =...
Migration of unique value isn't working Question: I'm trying to execute a migration where it add a `UUID` field to an existing table. I made the step by step of what is explained in the Django documentation (<https://docs.djangoproject.com/en/1.8/howto/writing- migrations/#migrations-that-add-unique-fields>), but it's ...
python numpy parse array to get items Question: Hi I tried taking distinct items of every sublist and making an array My input is a 2D list alist = [['1','2'], ['3','5','2'], ['15','1'], ['5','657','3','1']] And output I want is an array of distinct items out = [1,2,3,5,15,657] ...
Is it necessary to call seed() when using random in Python? Question: I was looking at the following code: from random import choice for val in range(10): a = ','.join(str(choice(range(20))) for idx in range(4)) print a And realized that I hadn't used seed(). I've been taug...
compilation issue when running theano Question: I installed theano on windows 8, 64 bit. I am using anaconda implementation, python 3.4. Trying to install theano, I diligently followed all steps on this link (which helped on another computer with similar configuration): <http://rosinality.ncity.net/doku.php?id=python:...
Python:not getting Length of longest common subsequence of lists Question: I tried to implement in LCS in simplest way I can but I am not getting the right value. Instead of 4 I get . I am not sure whats wrong with my code: X= ['A','B','C','B','D','A','B'] Y= ['B','D','C','A','B','A','X','Y'] ...
What configuration settings are required in Django and MySQL for supporting concurrent requests? Question: I have created a project called test123, following are settings.py and urls.py : MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.Comm...
Dependency injection in imported python module Question: My python module uses some functions from another module, but I have several implementations of that module interface. How to point out, which one to use? Simple example: A.py: import B def say_hi() print "Message: " + B.greeting() ...
Trouble with ReadProcessMemory in python to read 64bit process memory Question: I'm getting error code 998 (ERROR_NOACCESS) when using ReadProcessMemory to read the memory of a 64bit process (Minesweeper). I'm using python 3.5 64bit on windows 7 64bit. The strange thing is, this error only happens with addresses that ...
Python response to JavaScript Question: I have an AJAX request to my Python file like so $ajax({ type: "post", url: " name.py", data: { param: "hello" } }).done(function(obj){ alert(obj); }); I want to get that request from my Python file and send a response ...
AttributeError: 'int' object has no attribute 'x' Question: I realize this is a common topic for posts here, however, I can't seem to find one example that really helped me fix the problem. I'm trying to run a script that will add two new fields (x and y coords) to a shapefile then populate those fields with X and Y co...
Pickle in python, writing to files Question: if group == 10G2: file_name='10G2 Scores.txt' fileObject = open(file_Name,'wb') pickle.dump(+str(name) + ' got ' + str(finalscore) + ' percent from ' + str(totalquestions) + ' question(s), this is ' + str(score) + ' out of ' + str(totalquestions) + '.') ,fi...
Python class variable dependencies Question: If have a class that looks something like import numpy as np class Test(object): def __init__(self, args): self.x = args[0] self.y = args[1] self.values = np.array([self.x, self.y]) And I want to be ab...
Python setuptools package_data - pip fails on subfolders Question: I am trying to make my own pip package installation to work and I have troubles with subfolders in additional data specified in package_data. Everything seems to be fine (all data are included in produced .zip file), but when I run "pip install myapp", ...
Server/Client continuous connection in python? (Python 3x) Question: Hi everyone this is my firs post here and I have a question about python server/client continuous connection where I can write as a client and comes back to the server, and it shouldn't stop till i type "end". > **This is my server:** f...
Customize pyuic's resource import statement? Question: When I use this command on windows: python -m PyQt4.uic.pyuic user_interface.ui -o user_interface.py After that, I add a resource: pyrcc4.exe -py3 images.qrc -o images.py And I end up with two beautiful files, **user_interf...
etree import not working- Python 2.7.5 Question: I'm trying to use elementtree to parse xml but the import is giving me an error. **No module named etree** I've tried : from xml.etree import ElementTree as ET import xml.etree.ElementTree as ET I have elementtree downloaded in my python l...
IPython notebook: how to reload all modules in a specific Python file? Question: I define many modules in a file, and add `from myFile import *` to the first line of my ipython notebook so that I can use it as dependency for other parts in this notebook. Currently my workflow is: 1. modify `myFile` 2. restart the...
QuantLib cpibond bond example in Python Question: I am trying to get the official C++ cpibond example working in Python. The original example is here: <https://github.com/lballabio/quantlib/blob/master/QuantLib/test- suite/inflationcpibond.cpp> and for scala here: <https://github.com/lballabio/quantlib/blob/master/Quan...
Getting Camera model information of an image using Python Question: I am working on python automation in which I have to collect the camera model (canon, Nikon etc.) information of an image. I searched a lot but I am getting only pixel resolution, size and other data of an image. Is there any API or library in which we...
python array manipulation and rearranging Question: I am trying to manipulate an array and perform operations. My input is an array a= [['f' '0' '1' '0' '1' '0'] ['o' '0' '0' '1' '0' '0'] ['o' '0' '1' '0' '1' '1'] ['!b' '1' '0' '1' '0' '0'] ['a' '0' '0' '1' ...
Python: Average a list and append to dictionary Question: I have a dictionary of names with a number (a score) assigned to them. The file is laid out as so: Person A,7 Peron B,6 If a name is repeated in the file e.g. Person B occurred on 3 lines with 3 different scores I want to calculate the m...
TAB Key in Python Question: I'm working on a Python application that asks the user for two inputs, but in order for them to go to the next input, they need to hit ENTER/RETURN, is it possible to also use the TAB key? Right now, if the user hits TAB, it'll just add a space to the text. [EDIT] I did try the sys.stdin m...
Printing UTF32 Symbols in Word Macros Question: I am playing around with VBA for Word, and I am working on a project to do a batch find/replace in a word document. I imported a list of find/replace terms from a .csv. The issue I'm running into is that I want to replace words with symbols that represent the words. For ...
send POST request to web services in python Question: I need to consume a several's SOAP web services, if I send a xml file as request I get the response without issues. But I want to send only some arguments and not all the xml file To make a request I send like the using REQUESTS library: import reque...
Python script works in librarys examples folder, but not in parent directory Question: I have a newbie problem. I have a Raspberry Pi 2 computer. I connected DHT11 sensor to GPIO PIN 4. Next, I've installed Adafruit_DHT_python library by running setup.py file using command: sudo ./setup.py After in...
getting invoking module's name in Python Question: Is there a more straight-forward way of getting the name of the invoking module than this: script_file_path = sys.argv[0] top_module_name = None for frame in reversed(inspect.stack()): if frame[1] == script_file_path: top_modu...
Finding and uninstalling PIL on Mac Question: I want to install Pillow and have read in many places this only works if PIL is removed. Somewhere I have PIL installed but I am unable to find it or remember how it was installed. I'm pretty much a ctrl+c and ctrl+v guy when it comes to installing things through terminal,...
Python PeeWee IntegerField - Default value of unix timestamp Question: I would like to manage timestamps in my database using seconds since epoch using a PeeWee IntegerField rather than a DateTimeField. I know that the field definition can take a default value using a callable, but I would need to do something like: ...
When registering a table using the %pyspark interpreter in Zeppelin, I can't access the table in %sql Question: I am using Zeppelin 0.5.5. I found this code/sample here for python as I couldn't get my own to work with %pyspark <http://www.makedatauseful.com/python-spark-sql-zeppelin-tutorial/>. I have a feeling his %py...
Tkinter unable to alloc 71867 bytes Question: so, I am playing with GUI and with Tkinter, I was trying to make a notepad in python. my code so far: from Tkinter import * def hello(): print "hello!" ventana = Tk() barra_menu=Menu(ventana) barra_menu.add_command(label="Ar...
pysnmp snmp get with managed objects Question: I'm trying to figure out how to load mibs and get the sysObjectID of a cisco switch and then resolve it into something human readable. Right now my code works but what is confusing me is are the arguments for getCmd(), instead of sending a string with OID how do I send a m...
Get spotify currently playing track Question: **EDIT : Let's try to clarify all this.** I'm writing a python script, and I want it to tell me the song that Spotify is currently playing. I've tried looking for libraries that could help me but didn't find any that are still maintained and working. I've also looked thro...
Python Threading loop Question: I am have problem with this THREDING example. I have it working pretty good, but my problem is after it shows all 100 student threads. I am trying to put 20 random students in five different classes, but no matter what I do I can't seem to get the loop to work. If someone could please gi...
inconsistent plot between matplotlib and seaborn in Python Question: i am trying to add errorbars using `plt.errorbar` to a `pointplot` in seaborn: import matplotlib import matplotlib.pylab as plt import seaborn as sns import pandas sns.set_style("white") data = pandas.DataFrame(...
How to use a template html in different folder on Google App Engine python? Question: I am trying to use a templated html file in a different folder on python and I am running into file not found error. For example, index_path = os.path.join (os.path.join(os.path.dirname( __file__ ), '..', 'html'), 'inde...
Merging numpy array elements using join() in python Question: Want to convert the following numpy array a a = [ array([['x', 'y', 'k'], ['d', '2', 'z'], ['a', '15', 'r']], dtype='|S2'), array([['p', '49'], ['l', 'n']], dtype='|S2'), array([['5', 'y'], ['33', 'u'], ['v', 'z'...
Sort timestamp in python dictionary Question: mydict = [{'Counted number': '26', 'Timestamp': '8/10/2015 13:07:38'},{'Counted number': '14','Timestamp': '8/10/2015 11:51:14'},{'Counted number': '28','Timestamp': '8/10/2015 13:06:27'}, {'Counted number': '20','Timestamp': '8/10/2015 12:53:42'}] How to sort th...
Python decorator for permission Question: it is my first time to use a decorator and I want to show something like this import functools def checkUser(tag): def dec(f0): @functools.wraps(f0) def wrapper(userName, loggedinUser): if userName == ...
Python - Selenium Locate elements by href Question: I am trying to find (and click) specific pages for my Python program using selenium. I have tried driver.findElement(By.cssSelector("a[href*='text']")).click(); And driver.findElement(By.partialLinkText("text")).click(); With...
Python regular expressions and Excel Question: Im trying to perform regular match on data that came from excel to python array using openpyxl but the data came as unicode and "None" is allways given by python. The data in Hebrew and i whant to convert the strings from excel to strings that can be matched using regex.. ...
R summary() equivalent in numpy Question: Is there an equivalent of `R`'s `summary()` function in `numpy`? `numpy` has std, mean, average functions separately, but does it have a function that sums up everything, like `summary` does in `R`? If found [this](http://stackoverflow.com/questions/27637281/what-are-python- ...
Python:Understanding inheritance Question: Am new to Python and was exploring Classes and Object. I have created a class,defined few function in it. Then I have created another class and was trying to inherit from the first class but got some error. **Error:** class CTC(Salary): NameError: name 'Salary' is not defined ...
How to replace the underscores with chosen letters in hangman Question: In my piece of code, I am having trouble replacing the underscores displayed by the length of the word with the correct letters. How do I solve this?. Below is a example of my code being run. print("Welcome to Python Hangman") p...
Correct way of "Absolute Import" in Python 2.7 Question: * Python 2.7.10 * In virtualenv * Enable `from __future__ import absolute_import` in each module The directory tree looks like: Project/ prjt/ __init__.py pkg1/ __init__.py modu...
Python: how can I ingest arguments from JSON file? Question: I have a block of python code that ingests command-line arguments, e.g.: import argparse if __name__ == "__main__": # myScript.py parser = argparse.ArgumentParser() parser.add_argument("-i", "--int", help="Int...
creating a new copy of a python class each time it's called Question: I need some guidance on how to set this up correctly for what I'm trying to do. I have a class called Attribute Block which I'll then use to create 3 or 4 Attribute block Objects. As seen below... class AttributeBlock(): def __...
Resizing matrix getting rid of 0 entries - Python Question: I have my matrix `E`, which I have been filling in some way (it is not important how, the important thing is that the entries are all different from 0). The dimension of the matrix is `n_x*n_y` X `n_x*n_y`, where n_x = 4 n_y = 8 Now I ...
Changing title of image to display many images simultaneously using open cv and python Question: Hi I am using open cv 2 library with python ver 2.7.6 I have written the code which basically takes a image as input but the output shows only 1 window ... not n windows. Can any one please tell how i can display all the...
Using pysed in script Question: I can run successfully on command line but having problems in python script. It complains of the second double quote. pysed -r "192.168.33.10" "$NEW_IP" FILE --write ^ SyntaxError: invalid syntax How can I run this inside a script? An...
Implementation of Dijkstra's algorithm with Networkx, reveicing a print error Question: I'm trying to read a file with source target weight values respectively to find the shortest path and print that path with the final weight. I'm using Networkx to use the Dijkstra function. However, when I execute, I receive this no...
Catch bash/git fatal in python Question: I would like to write a simple python script which will be able to clone a git repository into desired directory. I used try...except construction to be able to catch all exceptions however it looks like I am not able to handle 'fatal' properly. #!/usr/bin/env pyt...
Python file keyword argument? Question: In command line I am able to pass arguments to a python file as: python script.py arg1 arg2 I can than retrieve `arg1` and `arg2` within `script.py` as: import sys arg1 = sys.argv[1] arg2 = sys.argv[2] However, I would like to sen...
Cross-platform IDE for cross-platform high-level language with easy GUI creation (to replace VB .NET) Question: Suppose that you wish to show somebody who is not familiar with any programming language and he/she will (probably) not be involved in professional programming, some basics concepts: you would like to provide...
How do I compare a response.data serialized object using Python / Django when unittesting? Question: This is my view: class ChatViewSet(viewsets.ModelViewSet): serializer_class = ChatSerializer def get_queryset(self): return Chat.objects.filter(users__in=[self.request.use...
Using turtle.onscreenclick to find coordinates of a mouse click Question: I simply want to use the turtle method onscreenclick to find the coordinates of a mouse click. Currently, I have a grid on which I am playing Othello. I already have the algorithm to convert the raw coordinates to specific grid coordinates that c...
ImportError by standalone executable created by Python's Freeze tool Question: I have installed python2.7.10 in Linux Ubuntu.(I use source tarball) ./configure make I want to get an executable binary file to use in a remote server that does not have Python installed. I used the command ...
python opencv import libraries error Question: I'm trying to run the facedetect.py sample code : [here ](https://github.com/Itseez/opencv/blob/master/samples/python2/facedetect.py) but I don't really understand what are these two line in the import section from video import create_capture from commo...
python flask normal function to decoration Question: I have this python `flask` code : @app.errorhandler(404) def not_found(e): logg = open("server_log_404.txt", 'a') logg.write("\r\n\r\n========================\n") logg.write("%s\n" % datetime.datetime.today().ctime()) ...
How to get VNC security type from server with sockets on Python? Question: How to create a script for Python , which will be connect to specific ip with port , and print/return , which security type VNC connection have? import socket def check(ip,port): vnc = socket.socket(socket.AF_INET,sock...
Matplotlib Legends for barh Question: I am a beginner with python and matplotlib. I want to create a horizontal bar chart with a legend. My code: import matplotlib.pyplot as plt plt.rcdefaults() import numpy as np import matplotlib.pyplot as plt # Example data people = ('Tom', 'D...
How to extract timing info like HH:MM:SS from a given list using for loop in Python without importing any module Question: ['From', 'stephen.marquard@uct.ac.za', 'Sat', 'Jan', '5', '09:14:16', '2008', 'From:', 'stephen.marquard@uct.ac.za', 'From', 'louis@media.berkeley.edu', 'Fri', 'Jan', '4', '18:10:48'...
Using Python Exscript to connect to an AIX box Question: Here is the code that I am using. For some reasons it is not working, what am I missing? Not sure what else I can add to my post but the site is asking me to add more details account = Account(name= 'MiniMe', password = 'password') conn = SSH2(...
Find substrings in PyMongo Question: I wanted to find sub-strings within a field in MongoDB using PyMongo. The following query works fine and is what I require: db.collection.find({ "Animal": /cat|Dog/i}) However, if I try passing the value `/cat|Dog/i` as a string in Python, it doesn't work. Is ...
Paho Python Client with HiveMQ Question: i am developing a module in python that will allow me to connect my raspberry pi to a version of hivemq hosted on my pc. it connects normally but when i add hivemq's file auth plugin it doesnt seem to work im using the username_pw_set to set my username and password here is w...
IOError: Errno 13 Permission denied for specific files Question: I'm running a flask API which can be used to upload jpg files. It's been working fine for about a year, but today, out of the blue, uploaded files are rejected for a specific user of the API. There's actually not any difference in the treatment of the req...
Is it a good idea to define my own random.randbool? Question: Python does not have a `random.randbool` function, although it has `randint`, `randrange` and `random`. If I wanted to use a `randbool` function, nothing stops me from using the following code: import random random.randbool = lambda: rando...
How do I run both these turtle scripts one after another Question: import random import turtle spiral = turtle.Turtle() turtle.bgcolor("black") spiral.color("cadet blue") randomfive = random.randint(5,15) spiral.pensize(randomfive) randomfour = random.randint(20,75) ...
Creating an Azure Web App with Postgresql database (is that possible?) Question: I use Heroku to host a Django web app with a postgres back-end. I'm now looking to migrate this web app to Azure, taking advantage of a great deal Azure recently offered me. But I'm confused about one thing: how can I create a Django webs...
Are classobjects singleton in python? Question: If we have `x = type(a)` and `x == y`, does it necessarily imply that `x is y`? Here is a counter-example, but it's a cheat: >>> class BrokenEq(type): ... def __eq__(cls, other): ... return True ... >>> class A(metaclass=Br...
Django reporting 404 error on simple view? Question: I'm just barely getting started with Python and Django. I've created my modules, migrated, added my modules to the admin section, etc. Now, I need to create my first view. I've been following [this guide](https://docs.djangoproject.com/en/1.6/intro/tutorial03/) (Yes...
frame difference using python Question: I'm trying to do frame difference this is my code below import numpy as np import cv2 current_frame =cv2.VideoCapture(0) previous_frame=current_frame while(current_frame.isOpened()): current_frame_gray = cv2.cv...
Flask __init__.py import error Question: I can not import functions from other files to `__init__.py` in a flask. Importing something from a file gets an error 500. **__init__.py** from flask import Flask from fel import fel app = Flask(__name__) @app.route("/") def hello(): ...
Python crawler which than sends out results via email Question: thanks for helping. So I tried to make a little crawler which checks out the gif page of reddit, than writes down all the gifs + titles, puts them in a list and than sends this list via email _(to my work colleagues)_. So far so good, works perfectly, BUT...
Pythonic way to use context manager conditionally Question: This is something I think must come up quite often but I haven't been able to find a good solution for it. Say I have a function which may be passed an open resource as an argument (like a file or database connection object) or needs to create one itself. If t...
Remove duplicates from nested list using list as keys Question: I use to have two lists, `files` and `g_list` which were both regular lists. I wanted to remove the duplicates from `files` and have `g_list` match. I found this solution; from collections import OrderedDict as odict od = odict.from...
Shedskin can't locate module numpy Question: I'm using shedksin to convert a python file (that is dependent on numpy) to a C++ file. When executing through command prompt I get the error. Any ideas on what might be the problem ? Answer: I have found an answer. From Shedskin implementation: # Library Limitations Pro...
How to solve no such table: user in Heroku application? Question: I have deploy the application but its showing me an internal server error . the same application I have run on localhost but now I am trying to run through heroku but its not giving me an output. the application is there on the link given below <http://f...
Python cassandra-driver: The C extension needed to use libev was not found Question: I have Cassandra python driver version 2.5.1 installed with all required dependencies that is libev4, libev-dev, gcc, python-dev. However I am getting following error while importing `LibevConnection` > "The C extension needed to use ...
kill process and its sub/co-processes by getting their parent pid by python script Question: i am using MULTIPROCESSING to find my requirement. And when that runs i am getting a pid(may be parent! i don't know what to call that) then co processes with their own pid and reference id of first process. Now i need to kill...
Compute a CRC32C (Castagnoli) which uses the generator polynomial 1EDC6F41h following Rocksoft Model CRC Algorithm in Python Question: I did explore Crcmod python library but couldnt use it as my gen poly- 0x1EDC6F41 is not considered a 32 bit poly :( Is there a way to tweak it or any other python lib that I can use to...
Changing language typing direction using selenium Question: I am trying to change the typing direction of text using selenium Python to right to left. The normal Key sequence in the keyboard for that is CTRL+SHIFT (both right). I have tried the following: from selenium.webdriver.common.keys import K...
Speech recognition for Python 3.4 thats easy to work? Question: I wish to get a simple speech recognition that works. I have been looking at this on speech_recognition, When I execute the code the following error occurs import speech_recognition as sr r = sr.Recognizer() with sr.Microphone() as s...
Python3. Prompt requires ctrl+c and halts script Question: I'm writing a small script that runs through a directory and attempts to obtain version numbers by running "filename --version". Now for the most part it works or fails in a manageable way. However I've come across one file "iptables-restore" in /sbin/ that fai...
Python libtorrent creates empty torrent with magnet link Question: I tried to download a torrent (the specific .torrent file) given _only_ an info_hash. I know this was discussed here before, I even searched and modified my code accordingly. The result is the following: import libtorrent as lt import...
Having a colon in a networkx node Question: I need to create a graph using `networkx` (and `pydot2`) from data that I can't predict. I have a problem with the `:` character ; if I want to create a node called `I like Python because : it's fast and readable`, `networkx` will create two nodes, one called `I like python b...
timeit is not working in the python manage.py shell Question: I have to find time taken to run query in django project i.e. `python manage.py shell` code: >>> import timeit >>> d = {"a":1, "b":2} >>> def a1(): ... for i in d: ... a = i, d[i] ... >>> a1() ...
Randomising conditions with alternating order in PsychoPy Question: I have a simple experiment with 8 different trials that I wish to present only once without repeat; participants are asked to 'solve' a numeric sequence where 4 sequences have a solution (S) and 4 are unsolvable (U). Thus, I have 8 trials: S1, S2, S3...
Python distutils exclude setup.py Question: My `setup.py` script is simple: from distutils.core import setup setup(name='my-awesome-app', version='1.0', scripts=['my-awesome-app.py'], ) And the file structure is: my-awesome-app/ my-awesome-app.py...
Matplotlib didn’t show the plot Question: I don’t know why my matplotlib didn’t show plots, and no errors too. I thinks I missing something on its installation because when in IPython notebooks an QtIpython using `%mayplotlib inline` directive have no problems but when running from terminal or script didn’t show anythi...
Incorrect shape for arguments to lasagne function Question: I'm trying to build a neural network regressor using the [scikit- neuralnetwork](https://github.com/aigamedev/scikit-neuralnetwork) library. As I understand it, ny NN seems to be being built fine, but I keep running into the following error at the `nn.predict...
ioctl errorno: 25 in GPIB communication using python-gpib Question: I am trying to communicate with a Tektronix oscilloscope TDS 210 using a GPIB- USB-HS adapter of National Instruments. My system is Ubuntu 14.04.3 where I installed linux-gpib as described in this link: [Linux GPIB Driver package (source)](http://sourc...
Python: Exporting text list to a text file Question: I am new to Python and I was wondering how to save this hashed password list (stored in variable _passwords_) ['73868cb1848a216984dca1b6b0ee37bc', '2de9210e9173ca4151bb220a2ded6cdb', '8c064f4067cf0c59c68ec281f5786cb2'] to a text file in the forma...
Pyinstaller + Django = No module named 'django.core.context_processors' Question: I am trying to package my django app with pyinstaller and I created this pyinstaller spec file for this purpose: # -*- mode: python -*- block_cipher = None a = Analysis(['manage.py'], ...
Retrieve image of url to jpg file Question: from urllib.request import urlopen from shutil import copyfileobj sh='''http://www.stockcharts.com/h-sc/ui?s=GLD''' floc= '''c:/files/python/texts/sh.jpg''' with urlopen (sh) as str ,open (floc,'wb')as outf: copyfileobj(str,outf) ...
Writing processed data into excel using CSV Python Question: I'm trying to write some data into the excel spreadsheet using CSV. I'm writing a motif finder, reading the input from fasta and outputs to excel. But I'm having a hard time writing the data in a correct format. My desired result in the excel is like below.....
Python code to redirect stdin and stdout to a shell script Question: I am trying to write a program that reads from a file and writes to a new file using the command line. I am using the CommandLine class and using ArgParse to accept different args as well as the file names for input and output. I am trying to redirect...
how to print field in chinese in pymongo Question: I have an `extracted_text` field in each document and the value of `extracted_text` is some chinese text. when I want to print the `extracted_text` field the program encountered a run-time error. I know MongoDB store strings as `utf-8`, but my program failed to encode ...