473,542 Members | 15,359 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.
1
25,722
thread by: peachdot | last post Oct 4 '10 by: bvdet
hi, i want to create an array element of increment value in a loop. example: a= output of my code : a=
8
25,743
thread by: hidrkannan | last post Feb 16 '15 by: SurestTexas
I am reading a set of data from the excel workbook. Data are contained in 2 columns. Column A contains the names and Column B contains values. The issue is the value can be of any type integer, float, string, list or a tuple. When I read the data from a Cell it is read as of data type unicode. I would like to convert the unicode data type to...
13
25,746
thread by: youngjin.michael | last post Aug 30 '08 by: josh logan
Hello, I am new to Python and have one simple question to which I cannot find a satisfactory solution. I want to read text line-by-line from a text file, but want to ignore only the first line. I know how to do it in Java (Java has been my primary language for the last couple of years) and following is what I have in Python, but I don't...
4
25,828
thread by: tstrogen | last post Nov 3 '08 by: tstrogen
I am using Python 2.6 on Mac OS 10.3.9. I have been trying to use: image = urllib.URLopener() image.retrieve(url, filename) to download images from websites. I am able to do so, and end up with the appropriate file. However, when I try to open the file, I get an error message. It's something about corrupted data, and an unrecognised file....
9
25,846
thread by: custard_pie | last post Jul 19 '05 by: custard_pie
I need help sorting a list...I just can't figure out how to sort a list and then return a list with the index of the sorted items in the list for example if the list I want to sort is I need to be returned Can someone help please....
23
25,894
thread by: Hallvard B Furuseth | last post Jul 18 '05 by: jallan
Has someone got a Python routine or module which converts Unicode strings to lowercase (or uppercase)? What I actually need to do is to compare a number of strings in a case-insensitive manner, so I assume it's simplest to convert to lower/upper first. Possibly all strings will be from the latin-1 character set, so I could convert to...
2
26,003
Romlus
thread by: Romlus | last post Jun 28 '23 by: Eliadoming
In the Knytt Underground game written in Python, ini files are used with English dialogue text (key = value - value is some dialogue phrase), when I entering the Polish character eg. ęąćź displays '?' I tried to type escape character sometext\x119sometext sometext\u119sometext But it s not working. Game single backslash \ reads as a line...
10
26,012
thread by: dcrespo | last post Oct 29 '05 by: Bruno Desthuilliers
Hi all, How can I replace all None values with the string 'Null' in a dictionary? For example: convert this: a = {'item1': 45, 'item2': None} into this:
2
26,044
thread by: Eric Wichterich | last post Jul 18 '05 by: Russell E. Owen
Hello Pythonistas, I am trying to get certain (self-written) libraries imported into my scripts using statements like "from library import function.py". But they are not being found. I think that the pythonpath-variable must be expanded to the location
3
26,109
thread by: yinglcs | last post Mar 27 '07 by: irstas
I read the document here about exception handling in python: http://www.diveintopython.org/file_handling/index.html Can you please tell me how can I catch all exception in python? like this in Java: try { .... } catch (Throwable t) { ...
2
26,170
thread by: giovanniandrean | last post Oct 18 '23 by: codiumltd
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions interest rate in two functions) 2-ModelSettings.py is in charge of setting the model data, here you specify the structure of the data (mentions interest...
2
26,209
thread by: Rob | last post Jul 18 '05 by: Martin Franklin
My first GUI so be gentle... When I start my program I call a class that runs the initial window. While in this class if a certain button is pressed it calls a function outside the class. This function then initially calls another function to "root.destroy()". Basically I want the current window gone so the function I just called can open...
2
26,230
thread by: Jonathan Bowlas | last post Oct 16 '06 by: Rob Williscroft
Hi listers, I've written this little script to generate some html but I cannot get it to convert to a string so I can perform a replace() on the >, < characters that get returned. from StringIO import StringIO def generator_file(rsspath,titleintro,tickeropt): scripter=StringIO()
3
26,246
thread by: ateale | last post Jun 19 '07 by: ilikepython
Hey guys on my quest to learn python I keep coming across: def __init__ I think I understand it is defining a method called "init" - but what's with all the underscores. Or is it some builtin method of Python? Sorry - confused Cheers!
3
26,251
thread by: gert | last post Mar 2 '07 by: gert
Anybody can tell me what i need to import to make urlDecode() work in python2.5 please. import urllib urllib.urlDecode(post) #doesn't exist urllib.urldecode(post) #doesn't exist urldecode(post) #doesn't exist urlDecode(post) #doesn't exist
2
26,283
thread by: adri80386 | last post Mar 19 '07 by: Larry Bates
Hi: How I can get the current screen resolution settings (screen.width and screen.heigth in pixels) in python. Thanks in advance Adrian
5
26,292
360monkey
thread by: 360monkey | last post Mar 18 '20 by: firedoritofinge
Hi Bytes Community! I am using tkinter to create a GUI and was wondering how to make a "console" widget embedded in the GUI. Sort of like the python command line but inside the GUI Thanks in advance!
10
26,314
thread by: Hank Kingwood | last post Jul 18 '05 by: Peter Abel
This is probably an easy question, but I can't find a function (maybe my syntax is off...) to search for in a string. If someone would help out, I'd appreciate it! Also, how would you recommend searching for the following in the same string: -
7
26,372
thread by: cesco | last post Jan 17 '08 by: John Machin
Hi, I have a file containing four columns of data separated by tabs (\t) and I'd like to read a specific column from it (say the third). Is there any simple way to do this in Python? I've found quite interesting the linecache module but unfortunately that is (to my knowledge) only working on lines, not columns. Any suggestion?
5
26,374
thread by: calvin dong | last post Oct 29 '11 by: calvin dong
i am a beginner, i tried to have python generate a random integer from 0 to 10 my code looks like this: import random number = random.randint(0,10) print number i am using python 2.7 it gives AttributeError: 'module' object has no attribute 'randint'
2
26,428
thread by: caspardh | last post Jul 20 '06 by: dvs
i was trying to code a morse code decipherer which workd fine except that the .txt file that i was converting had linebreaks built in, i cant get python to ignore the line breaks and i cant find any characters for line breaks to remove them using the string.replace() function if anybody know the syntax for a line break or the ASCII characters...
6
26,440
thread by: Harlin Seritt | last post Jan 7 '06 by: Paul Rubin
I would like to take milliseconds and convert it to a more human-readable format like: 4 days 20 hours 10 minutes 35 seconds Is there something in the time module that can do this? I havent been able to find anything that would do it. Thanks,
6
26,495
thread by: flamesrock | last post Jul 19 '05 by: newcoder
so I know you can append a string. But how do you *prepend* a string, as shown in the following code #dirList = #string = """position""" #for x in len(dirList): # string += '>> %s'%dirList.pop() #(????????????) # to return
3
26,579
thread by: Tor Erik Sønvisen | last post Sep 28 '05 by: Iain King
Hi I create a canvas that is to big for the default window-size, so it gets cut to fit... How can I increase the window-size to make sure the canvas fits? regards tores
31
26,584
thread by: Derek Fountain | last post Jul 18 '05 by: Michael Hudson
Does Python have a timer mechanism? i.e. an "after 500 milliseconds, run this bit of code" sort of thing?

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.