15,185 Topics

Member Avatar for
Member Avatar for vegaseat

If you have a smaller image, you can include it in your program as a base64 encoded string. This way you don't have to worry about an image file to go with your code. In your program you can then decode it back to the familiar bytes of an image …

Member Avatar for HiHe
5
8K
Member Avatar for jamison234

Hi All, I am a newbie programmer in python and I am trying to read multiple csv files from a folder, perform some data sums based on timestamps for each row for all the csv files and then output the sums to one result csv file. So far I am …

Member Avatar for hughesadam_87
0
4K
Member Avatar for yasirsaleem

Hi all, I am generating graphs using "cairo plot" in web2py project. Here I am using BytesIO() stream for generating graphs. Everything runs fine when I run on localhost but when I deploy it on apache server and then run from different machines OR from different browsers in same machine …

0
39
Member Avatar for mbh1992

Need help with the following code, The error comes at line 20. import ogr import os, shutil,sys import osr regionShp = "ne_50m_geography_regions_polys.shp" regionFile = ogr.Open(regionShp) regionLayer = regionFile.GetLayer(0) spatRef = regionLayer.GetSpatialRef() countryShp = "ne_50m_admin_0_countries.shp" countryFile = ogr.Open(countryShp) countryLayer = countryFile.GetLayer(0) dstDir = "spatial_analysis_2" if os.path.exists(dstDef): shutil.rmtree(dstDir) os.mddir(dstDir) dstPath = os.path.join(dstDir, …

Member Avatar for ZZucker
0
187
Member Avatar for nUmbdA

I am working on an assignment for my fundamentals class and we have to create a program that is going to write/read/ and append a file. I wanted to set it up to check and see if example.txt exists. If so then append, else write. My question would be how …

Member Avatar for ZZucker
0
116
Member Avatar for anonymous0318

#Hello, I am working on a homework assignment that after many hours, I still cannot get to function correctly. #The point is to take a list input of ones and zeros and print a compressed version. #Example) #input: [1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,0,0,0,0] #output: *41*50*71001*40 #Since the compression takes up 3 symbols(asterisk, amount of …

Member Avatar for woooee
0
224
Member Avatar for premminister

Hi, I am currently getting JSON data from the discogs API (mp3 tag data) and wish to sort the results by the key's value. In this case I am trying to get data for a Guns n Roses song and the output has 1988 as the first one while the …

Member Avatar for Lardmeister
0
11K
Member Avatar for robinclarke95

Python webpage -please help Hi I am very new in python programming.I am trying make a basic webpage where I ask user to input url like "http://www.google.ca" and a description of the url like"search engine". Using python script I will add that url and description in dbm database and print …

0
44
Member Avatar for Matigo

Hello guys I have got a little programme that been written in Python, I did connect it to an application been created in Visual Basic 2010, But to run the Python file, Of course you will need to install the Python software/Format to be able to run the python file, …

Member Avatar for Matigo
0
231
Member Avatar for jarg12

Hello First apologies for being a total newb. Everyones gotta go though this stage i guess. I'm a teacher and I've written some python 3 code that does some handy stuff to grades. I can execute the code using IDLE and it does what I want it to(averaging scores, producing …

Member Avatar for pauljwells
0
170
Member Avatar for shayallenhill

Which is smarter? class HoldAttr(object): pass a = HoldAttr b = getattr(a, 'attrname', []) b.append(1) setattr(a, 'attrname', b) # or try: b.a.append(1) except AttributeError: b.a = [1] ... or something else? Trying to learn.

Member Avatar for hughesadam_87
0
407
Member Avatar for drichird

#module nametest def showName(): print("__name__ is: " + str(__name__)) If I import nametest into another module or into the shell interpreter and call nametest.showName() I find that name = "nametest", in other words __name__ gets the module name it is a built-in member of? The only exception I know of …

Member Avatar for drichird
0
247
Member Avatar for blahblah1234las

New concepts to be applied for this assignment Lists File input and output Exceptions Generating random numbers Debugging flags/messages (Note: style requirements from previous assignments e.g., functional decomposition must also be applied). Introduction Write a fitness simulation whereby a single runner is traveling a fixed distance. The runner only has …

Member Avatar for HiHe
0
125
Member Avatar for aaron.jensen.923

Write a Python program which will read data for several students from a text file and create a list of lists to store that data. The data must be read from a text file named “Lab11.txt”. Each line in the text file contains the first name, last name, techid, number …

Member Avatar for HiHe
0
307
Member Avatar for fdama

Hi, I am working on an exercise in a book and have difficulty with it. I have completed the first part of the exercise which was to create a guessing game where the the player attempts to guess a secret number randomly generated. Suggestions such as to guess Lower and …

Member Avatar for woooee
0
266
Member Avatar for krystosan

I want to move/ delete not os.remove files or folder recycle bin on windows or trash in other OSes using standard lib available in python .. is it possible ?

Member Avatar for krystosan
0
116
Member Avatar for krystosan

well this is more about what i want to learn, todat I downlaoded send2trash package and installed it, i opened __init__.py that came with it and it had the following code which i can very well understand except for the period infront of each module name.. if sys.platform == u'darwin': …

Member Avatar for TrustyTony
0
96
Member Avatar for natehome

so im trying to make a very basic multiplayer game that gets a players x y from a server then displays the player. the script works fine when there is only one user in the database but when more users are added the script wont display the right player. i …

Member Avatar for christopher.j.burnham
0
600
Member Avatar for hisan

I am a newbie to py.test , Please let me know how to run the py.test in PyScripter Editor. I have tried in the belwo way but it doesn't work. import pytest def func(x): return x + 1 def test_answer(): assert func(3) == 5 pytest.main()

Member Avatar for hisan
0
81
Member Avatar for Trunar

The project is: -------------------------------- Write a program that computes and prints the average of the numbers in a text file. You should make use of two higher-order functions (i.e., map and reduce, or something else) to simplify the design. Create a text file and name as numbers.txt and add the …

Member Avatar for hayatkhansum
0
2K
Member Avatar for MissAuditore

Hi, I have a csv file im reading and this is what I have done so far: import csv filename='C:\Users\temperature.csv' with open(filename, 'rb') as csvf: reader = csv.reader(csvf) for row in reader: print row the result is as following: ['Depth (m);15.08.2012 15:39:09;15.08.2012 16:09:10;15.08.2012 16:39:10;15.08.2012 16:43:36'] ['0;53.218;52.804;52.865;51.202'] ['0.128;53.107;52.709;52.414;52.141;'] ['1.143;52.205;51.88;51.664;51.234'] ['2.159;51.026;50.846;50.842;51.258'] ['3.174;50.061;50.055;50.457;50.19'] …

Member Avatar for HiHe
0
230
Member Avatar for crazyjdog

This is a program I am working on for homework and I keep getting this error and I'm not sure what I can do to fix it. Any help would be greatly appreciated. here is the error: Traceback (most recent call last): File "C:\Users\crazyjdog\Desktop\School Stuff\CSET 1100\Programs and Charts\program121.py", line 86, …

Member Avatar for JasonHippy
0
462
Member Avatar for GoodPie

Hey there, i'm relatively new to pyGame and considering this is like my second attempt at doing it by myself after watching a few tutorials, i'd say im getting the hang of it. However, as i was creating a game i realised i had no clue how to make the …

Member Avatar for GoodPie
0
213
Member Avatar for ArtemKrass

Hello! Sory for my English, i'am from Russia Please, Help Me... There is such code: #coding:utf-8 import wx import sys import time import cefpython class MainFrame(wx.Frame): browser = None def __init__(self): wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title='wxPython example', size=(1000,800)) self.browser = cefpython.CreateBrowser(self.GetHandle(), browserSettings={}, navigateURL="http://google.com") class MyApp(wx.App): timer = None timerID = 1 …

Member Avatar for ArtemKrass
0
132
Member Avatar for crazyjdog

I am trying to create a program that takes an input from a user for a file name and then a text string and removes the string from the file. I have been at this one for a while and I have exausted just about every idea I had to …

Member Avatar for woooee
0
102
Member Avatar for krystosan

how should i save data like {username , passwords} to disk for later retrieval so that it cannot be opend and read in by a text editor?

Member Avatar for krystosan
0
168
Member Avatar for HiHe

Seconds since epoch should be zero, but are not: '''timetuple1.py create a time tuple for epoch 1/1/1970 00:00:00 however, seconds since epoch does not give 0 ''' import time timetuple = time.strptime("01/01/1970 00:00:00", "%m/%d/%Y %H:%M:%S") print(timetuple) print('-'*40) # seconds since epoch 1/1/1970 00:00:00 secs = time.mktime(timetuple) print(secs) '''my result >> …

Member Avatar for HiHe
0
381
Member Avatar for dwhite12

I am running into a strange error everytime I use lxml.etree and was wondering if anyone else has ran into this problem before. It was not until, what I believe happened my lxml was updated to a new version, that I started to get this problem. the error is "File …

Member Avatar for dwhite12
0
304
Member Avatar for subhabrata.banerjee.984

class Calculate: def __init__(self): self.prior = {} self.total = {} self.count = 0 def add(self, cls, obs): self.prior[cls] = self.prior.get(cls, 0) + 1 for idx, val in enumerate(obs): key = cls, idx, val self.total[key] = self.total.get(key, 0) + 1 self.count += 1 def discr(self, cls, obs): result = self.prior[cls]/self.count for …

Member Avatar for rrashkin
0
126
Member Avatar for Inshu

I have this programme to discuss and I think its a challenging one.. Here I have a yml file which contains the data for an image. The image has x,y,z values and intensity data which is stored in this yml file. I have used opencv to load the data and …

0
152

The End.