473,554 Members | 4,151 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python Forum

Python programming language - Ask questions about python interpreter, control flow, data structures, modules errors, classes, standard library, gui, databases, unit testing, object oriented, structured programming and more.
0
1,168
thread by: AliMohebbian | last post Jun 22 '16 by: AliMohebbian
What I am trying to achieve is to firstly read the intvariable values defined globally and insert into a textbox when the program is ran, secondly I need to enable the user to change the values if they wish to. the code is: from numpy import * import numpy as np import matplotlib.pyplot as plt import os from matplotlib import style from...
0
1,198
thread by: snakyjake | last post Jun 22 '16 by: snakyjake
How do I share a module variable with another class module? Ideally I want file2.py to inherit the variables+value from file1.py. When I import a module, I want access to the variables (by reference), not a copy. # file1.py import file2 var1 = None
0
896
thread by: atinesh922 | last post Jul 4 '16 by: atinesh922
Longest Increasing Subsequence I'm trying to implement a program for Longest Increasing Subsequence, It's giving correct output for some input patterns, But for some it's giving incorrect result. Can anybody tell me where is the bug in the code. Here's my code def binary_search(t, l, r, key): while (r - l > 1): m = l + (r -...
0
963
thread by: Krypton | last post Jul 4 '16 by: Krypton
I made a dictionary using passenger Id's given in data as keys and then it contains all the details given: from collections import defaultdict Passenger=defaultdict(list) for points in Data: ID=points Passenger.append(data.loc) Passenger output: [PassengerId 1
0
1,079
thread by: pavanijh | last post Jul 4 '16 by: pavanijh
i want to increment only one number in a file instead of that i am getting only string is displaying but not the number kindly help me in this ) count=0 data ="routing context count" while count < 2: count+=1 print(data)
0
950
thread by: newandlearning1 | last post Jul 4 '16 by: newandlearning1
I am trying to isolate date from date/time which is a column in the original csv file. I've isolated the column and change it to just date but I am having a tough time putting it back to the original file: def isolateDate(csv_file): file_in = open(csv_file, "rU") reader = csv.reader(file_in) next(file_in,None) ...
0
1,015
thread by: ashgangl | last post Jul 12 '16 by: ashgangl
im calling pyhook related script from python windows service its not getting execute but for normal execution and debug its working fine.import pythoncom,pyHook , sys import datetime import win32api import ctypes last_event = '' def info(idle_time) : try : fo = open("testschd.txt", "a+") except : fo = open("testschd.txt", "wb")
0
1,107
thread by: hamdi fazzani | last post Jul 16 '16 by: hamdi fazzani
i wrote a code usingg python 2.7 to print a few lines ... using the termina ( ./file.py) the printer work fine but when i prss F5 it tell that i can use the printer . this is my code Epson =printer.Usb(0x04b8,0x0e15) Epson.set("CENTER","B","B",2,2) Epson.text(" my text ") Epson.cut()
0
1,079
thread by: Kikie | last post Jul 16 '16 by: Kikie
how to append(TO add a new item) to a dictionary that already exists
0
942
thread by: naziashahabudin | last post Jul 19 '16 by: naziashahabudin
Need to write unit tests for the attached python module. Wanted to create mock objects for logger concept. need help in creating and using logger mock objects for writing unit tests for display function logger has 2 functions: log and info
0
1,851
ryno du preez
thread by: ryno du preez | last post Jul 20 '16 by: ryno du preez
Hello All I'm new to Python And tkinter With that said I'm trying to write a simple code to show a progress bar while I'm copying files from one directory to another one. But all my efforts has turned out to be a waste of time. I wold really appreciate any help on this. The end result will be a Gui for the user to click on and the copy process...
0
1,288
thread by: stringtheorist | last post Jul 27 '16 by: stringtheorist
Hi everyone, Basically, I have created a thread which continuously writes a global variable in a loop. Then I have the mainframe which should read and display that variable. The problem is that once the mainframe runs, it displays the value of the variable which it read at the time of startup only, and does not continuously update itself....
0
1,142
thread by: Raj4perl | last post Aug 4 '16 by: Raj4perl
import sys import time import os from PIL import ImageGrab print("Enter time interval to take screenshot") time_int = 3 print("Time interval entered is %(time)d" %{"time":time_int}) img = ImageGrab.grab() localtime = time.asctime( time.localtime(time.time()) )
0
926
thread by: icelexB | last post Aug 25 '16 by: icelexB
i have a programming assignment, to count number of particular lines in a textfile. and extract the numbers in that particular line. how can i do this, i successfully counted the number of lines, but how do i extract these numbers and make my computations?
0
946
thread by: bishaq | last post Aug 25 '16 by: bishaq
I have added a custom File handler to create a log file append with date and time in a specified directory. Everything works fine if I have my main.py and logconfig.py and MyFileHandler.py in the same directory. As soon as I move my logconfig.py and MyFileHandler.py in a different directory, my code starts throwing following error....
0
964
thread by: shyuanguo | last post Aug 28 '16 by: shyuanguo
I have two programs, say M and C. M have two quantities x and xe as outputs, the x and xe served as input to C. Since each time i got a pair of (x, xe) i must run C by hand, i want to find a way to make this process automated. C was an python script, to run it one should type: ./C -x x -xe xe in the command line. So i wander if i could write...
0
1,094
thread by: Princesskassy | last post Sep 9 '16 by: Princesskassy
i saw this code online and i want to know what that third line is for.... import turtle star = turtle.Turtle() for i in range(50): star.forward(50) star.right(144)
0
1,023
thread by: shalby | last post Sep 21 '16 by: shalby
i'm trying to use raid bot for xat but it's keep telling me list index out of rage it was not doing that before month ago
0
1,089
thread by: rspvsanjay | last post Sep 23 '16 by: rspvsanjay
import org.python.core.PyObject; import org.python.core.PyString; import org.python.core.__builtin__; import org.python.util.PythonInterpreter; public class JythonTest1 { public static void main(String args) { PythonInterpreter interpreter = new PythonInterpreter(); }}
0
951
thread by: Rashmi002 | last post Oct 18 '16 by: Rashmi002
I am developing small application where f1.py file has one class which contain frame1.When i clicked on search button frame should replaced with frame2 and progressbar should be diplayed.but this progressbar's argumets are coming from f2.py which have one class.f2.pyis imported to f1.py for use of class methods.Now how can i replace this frame...
0
2,195
thread by: jacksonmjose | last post Oct 20 '16 by: jacksonmjose
I have made the Excel application visible =0 in my program so that it will perform the excel operations in background and wont disturb my regular work. But what happens is that when ever any other excel sheet is open in my system that is not at all related to the python program. It is showing the following error "AttributeError: Property...
0
2,231
thread by: kikiegoguma | last post Oct 24 '16 by: kikiegoguma
i use this code as my reference : import pylab as plt import numpy as np from scipy.spatial.distance import cdist, pdist from sklearn.cluster import KMeans from sklearn.datasets import load_iris iris = load_iris()
0
1,190
thread by: jdcrew | last post Nov 5 '16 by: jdcrew
Hi,All, background:I have a python api like this, def a(arg1,arg2,progress_callback = None) obviously argument progress_callback is a callback function.In python,I can define a function like this: def pro_call(prog_arg1,prog_arg2): #do something with arg1 & arg2 and I just need call a function like...
0
1,243
thread by: rspvsanjay | last post Nov 18 '16 by: rspvsanjay
This program (below), I am able to run from command prompt but when i am using eclipse that is not returning any text. May this is not running python file java file and python file is present in bin folder when i am using command prompt when i am using eclipse java and python both file is present in default package . what i do to run...
0
1,084
thread by: handar | last post Nov 29 '16 by: handar
How do I use Python to split a csv into multiple columns? (using split function using python) "CUSTOMERID","DESCRIPTION","FARE","GUESTS","SEATCLASS","SUCCESS" "1","Braund, Mr. Owen Harris;22","7.25","1","3","0" "2","Cumings, Mrs. John Bradley (Florence Briggs Thayer);38","71.2833","1","1","1" "3","Heikkinen, Miss....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.