15,175 Topics

Member Avatar for
Member Avatar for Cenchrus

"del" allows you to delete elements from a list for example... [CODE] # Makes list, note in python when addressing an element, the first element is 0, the second is 1. a = [1,2,3,4] # [0,1,2,3] shows how python "reads" the location. # Prints elements in list a print a …

Member Avatar for vegaseat
0
163
Member Avatar for Ismatus3

Hello friends , I just need to know if I can print a Tkinter window on paper , if yes i need to know how , it is a window of a form of a new inscription . Thank you very much :)

Member Avatar for Ismatus3
0
104
Member Avatar for tcl76

hi, attached is my sample file. i want to extract all lines starting from -- num until before -- Advanced. appreciate if anyone can show me. thanks johnny

Member Avatar for tcl76
0
620
Member Avatar for pwolf

well this is the first time i am trying to make a module, i saved the .py file into a new directory called MyModules and tried to import it in IDLE, but it returned the following error; Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import polymod …

Member Avatar for pwolf
0
569
Member Avatar for sofia85

Hi, I have python script where I've extracted many p-values. The next step is to calculate the ROC-curve, or i.e. the AUC (the area under the curve), for these p-values. I'm not excactly sure on how to calculate the ROC (e.g. exactly what it takes as input) and I'm also …

0
73
Member Avatar for skix

Hello, I am fairly new to Python. I have only skimmed the surface in an introductory class I just finished in college. As my first program in Python, I am attempting to make a text editor. I am wondering if there is a universal command to bring up a Save …

Member Avatar for Notouch
0
11K
Member Avatar for D33wakar

If there's a list like below [CODE]s=['b','a','r','r','i','s','t','e','r'][/CODE] and if I tried to remove every 'r' from the list like this [CODE]>>> for x in s: if(x=='r'): s.remove(x)[/CODE] it gives the following result. [CODE]>>> s ['b', 'a', 'i', 's', 't', 'e', 'r'][/CODE] Why isn't the last 'r' removed from the list.

Member Avatar for D33wakar
0
102
Member Avatar for hovestar

Hello I'm working on printing a grid of any size and labeling it numerically or alphabetically I have the code that creates the grid, but I have no idea how I would label it... Here is the code that crates the grid: [CODE] def grid(): y = 5 #int(raw_input("How tall …

Member Avatar for TrustyTony
0
490
Member Avatar for pwolf

okay, so i was doing an exercise for this beginning python course i got my hands on, and i just completed the exercise (took longer than it should have though) and for some reason, when i run it, it returns data i didn't expect, and when i run it again …

Member Avatar for pwolf
0
170
Member Avatar for Cenchrus

I've been googleing the syntax, function, and examples for these keywords, but to no avail: 1. as 2. with 3. assert 4. pass 5. yield 6. break 7. except 8. class 9. exec 10. in 11. raise 12. continue 13. finally 14. is 15. for 16. lambda 17. try Help …

Member Avatar for Cenchrus
0
160
Member Avatar for dh273

You'll have to excuse me, I'm a complete python newbie, but am trying to import a pyd file that I've been sent by a friend. He assures me the file works fine on his computer but when I run [code] import myfile.pyd [/code], after having placed the pyd file in …

Member Avatar for tls-005
0
16K
Member Avatar for rhguh

I am working on a project that requires a CSV file to be read into a multidimensional array. I loop through the array, and set multidimensionalarray[x][n] to the corresponding data in the CSV file, but I keep getting IndexError: list index out of range. I can't figure out why, and …

Member Avatar for rhguh
0
291
Member Avatar for hadoque

I'm trying to understand socket programming in python by experimenting a little. I'm trying to create a server that you can connect to by telnet and that echoes what you type in the telnet prompt. I don't want to start using threads just yet. This is my code. [CODE]import socket …

Member Avatar for hadoque
0
9K
Member Avatar for Cupidvogel

Hi, I am just starting to learn Python GUI programming with Tkinter. The majority of examples on net and books show the widgets and windows in typical MS Windows style (i.e the blue top border, holding the maximizing, minimizing and cancelling buttons), as shown in the first picture. Is there …

Member Avatar for Cupidvogel
0
107
Member Avatar for pwolf

so im trying to make it so that pressing enter without inputting any value, will break the loop, however, an empty string can be used because of [ICODE]for i in range(len(x_str_array)): x[i] = int(x_str_array[i]) bit.[/ICODE] [CODE] 'Exercise 7.3' # modified program from exercise 7.2 a=1 z="" while x !=z: x_str …

Member Avatar for pwolf
0
209
Member Avatar for Shockbox

Hi everyone, I'm trying to write a Python script, where it counts the specific results from a database. Running the following line in MySQL Client works: SELECT name, COUNT(*) FROM results WHERE name="bla bla"; And it returns all of the results fine. But I'm trying to put it into a …

Member Avatar for smantscheff
0
56
Member Avatar for Pythonbeginner!

Hey guys. Im having some problems with python. I need to create a function that takes in two arguments where the first is a sequence(string) of letters. The other is also a string but of integers, that tells me start and stop that I want to cut out from the …

Member Avatar for TrustyTony
0
167
Member Avatar for scsi

Hello, i would like to ask you help with my code, i can't understand why exactly it doesn't work like i am expecting :). I am working through "How to Think Like a Computer Scientist" by Jeffrey Elkner, Allen B. Downey, and Chris Meyers so i am still doing my …

Member Avatar for TrustyTony
0
150
Member Avatar for lrh9

I am doing some hobby coding regarding neural networks, and I was wondering if this is a correct and good use of abstract base classes or not. [code=PYTHON]import abc import collections import math import weakref class AbstractNeuron(metaclass=abc.ABCMeta): def __init__(self, weights, f=math.tanh, bias=1, biasWeight=0): self.weights = weights self.f = f self.bias …

Member Avatar for TrustyTony
0
204
Member Avatar for amir1990

i have a problem with this code: [CODE]s = "johnny" j = 'j' y = 'y' re.search(rj'\w+'+y, s).group[/CODE] i want to put the j variable instead of the string, with the y variable its ok but with the j i got an error!!!

Member Avatar for amir1990
0
95
Member Avatar for sun_2588

Hello Everyone, I am making a GUI using Tkinter... I have completed that the GUI now i want to put the validation on those Entry Widget,,,,,... i know, i have to use the re module...... but i really cannot understand that....can someone please give me the simple example...like if i …

Member Avatar for TrustyTony
0
307
Member Avatar for natehome

im working on a tron game with pygame and i cant figure out how to make my tail that the player's car makes disappear after somany pixels. i want the tail to start shortening itself after like 500 pixels. if you can, can you post the full code edited (im …

Member Avatar for natehome
0
1K
Member Avatar for surakesh

<< This is my python code >> << (Step 1) - I am registering the class of this python file for this PythonUtil class by executing this code in the pythonwin.exe interpreter >> class PythonUtil: _public_methods_ = ['funct’] _reg_progid_ = "PythonUtil.Utilities" _reg_clsid_ = "{73B6791B-C161-4F26-9402-D4AE4BC602AB}" def funct(self, val, item=None): print “hi” …

Member Avatar for thines01
0
330
Member Avatar for natehome

im trying to write a tron game with python but when ever the tail starts to erase, it erases too much. try running it and you will see what i mean. when you run it drive over your tail and watch it delete too much. [CODE] import sys, random, time, …

0
88
Member Avatar for amir1990

Hi, i have this code: s = "hi john' re.serach(r'j\w+h', s).group() and up to here there is no problem but i want to put the letter h in a str variable l = "h" re.search(r'j\w+'l, s).group() but when i do this i receive an error??

Member Avatar for amir1990
0
79
Member Avatar for chris99

I'm using windows 7, hoping to use Tkinter to open an internet window when a button is clicked that goes to a specific page in google chrome. Is this possible? [CODE]class App: def __init__(self, master): frame = Frame(master) frame.pack() self.button = Button(frame, text="Rejuvenation", command=self.info) self.button.pack() def info(self): pass #Will go …

Member Avatar for inuasha
0
264
Member Avatar for inuasha

How would I find the amount of characters in a string and then use that to print a certain amount of some character that you choose. For example: [CODE=Python] a = 'string' # this holds 6 characters print '*' * # amount of characters in string [/CODE]

Member Avatar for inuasha
0
243
Member Avatar for Cap.Alvez

Hi everyone! I would like to know if python is any good for creating apps for cellphones .. like Iphone,Blackberry.. or even for Ipods? Ive been researching on this matter but I never got a good answer.. haha Thanks in advance! :)

Member Avatar for M.S.
0
194
Member Avatar for RLS0812

According to this post [url]http://www.python-forum.org/pythonforum/viewtopic.php?f=3&t=31349#p146797[/url] it claimed to be possible to create a list were you can store and recall data using a coordinate system ... [code]SomeList[1][5][2] = 234 [/code] I have been playing around with the code a while, and have ran into a problem. No matter what I …

Member Avatar for TrustyTony
0
206
Member Avatar for TrustyTony

Got inspired to make computer to make moves in English Solitaire, I learned in childhood days to solve by myself consistently, no solving or game play interface at the moment (easy to add though). I added printing of the ready solution from the wikipedia, also maybe of your interest are …

0
345

The End.