15,175 Topics

Member Avatar for
Member Avatar for novice20

hi, I just came accross the csv module to deals with csv files in python. suppose my csv file has two rows: 1,2,3,4 5,6,7,8 and i want to access each item at a time, i.e., 1 followed by 2 and so on....what can be done? [B]import csv reader= csv.reader(open('filename.csv','r'),delimiter=' ') …

Member Avatar for richieking
0
262
Member Avatar for dpd069

I am looking for a little assistance in slicing a (1050,1) array of temperatures. I have 2 temperature ranges T1-T2 and T2-T3 that i want to slice from the array using boolean slicing. How do I go about this? Dan

Member Avatar for Thisisnotanid
-1
83
Member Avatar for nosehat

Hi All-- I am working with zip archives, using the [URL="http://docs.python.org/library/zipfile.html"]zipfile module[/URL] to extract all the files with certain file extensions from each zip. In these zip archives the files I'm after all have their own path information, but I would like to extract the files I want into one …

Member Avatar for nosehat
0
166
Member Avatar for richieking

This is one of the easiest steps to view and convert dcm image useing the [B][COLOR="Red"]snake(python)[/COLOR][/B] There are 3 modules involved. 1. Search for [B]pydicom[/B] and install 2. Search for [B]matplotlib[/B] and install 3. Search for [B]pylab[/B] and install. If you are on ubuntu destro, Installing matplotlib via the repo …

Member Avatar for richieking
0
4K
Member Avatar for deepakgupta2186

I want to sort this dictionary through its keys.I am adding two lists into one dictionary...[CODE]list1=[] list2=[] dict1={} dict2={} n=input("Enter the number of contacts : ") for i in range(0,n): name1=raw_input("Enter your name: ") num=input("Enter your phone number: ") list1.extend([name1]) list2.extend([num]) dict1=dict(zip(list1,list2))#to convert two list into dictionary keys=dict1.keys() keys.sort() for …

Member Avatar for TrustyTony
0
176
Member Avatar for kuchi

Previously I used to work in java programming and now I got to switch to Python web programming. In java, to develop a web project and run the project, we use jboss server to deploy application, run the server (run.bat), and run the project. But in python I think the …

Member Avatar for snippsat
0
130
Member Avatar for Syphilis

Greetings kind shrew! So I'm needing to add a text resource to a PE executable file for Windows. However I'm unsure on how to do such. I did find a module called 'pefile' but this was of no help as it's functions did not include adding resources to files. I …

Member Avatar for mece
0
1K
Member Avatar for Brickmack

I was wondering if anyone knew of a way to scan for key presses in Python. It doesn't need to detect WHAT key is being pressed, just that one is being pressed. Also it needs to work with the console.

Member Avatar for richieking
0
270
Member Avatar for flebber

Hi I was reading the thread [URL="http://www.daniweb.com/forums/thread12326.html"]http://www.daniweb.com/forums/thread12326.html[/URL] which is about getting user input from a user in python. So I thought I would write something to tst it since I haven't used python in a while so I wrote a basic program to calculate netpay. [CODE]hours = raw_input("Enter Hours Worked: …

Member Avatar for snippsat
0
2K
Member Avatar for mece

I wrote a GUI tool that will display stats and refresh the stats when a refresh button is pushed. Now I would like to add a feature for the stats to auto refresh every five minutes. Is it possible to have the UI updated without binding an event handler? Thanks …

Member Avatar for mece
0
2K
Member Avatar for rotexhawk

Alright.. Seems I wasn't able to fully explain my problem.. Below is the full error printout. I tried debugging it and I still don't know why guessed[index] = (letter) gives me an error. I don't want to use the append method because it will put the new letter at the …

Member Avatar for rotexhawk
0
353
Member Avatar for ultimatebuster

Does Anyone know how to add context menu in win explorer on [B]files[/B]? And how do they work? Do they call a command and put the full filename after the command as arguments?

Member Avatar for ckoy
0
110
Member Avatar for python_user

Hi Everyone, I have a problem displaying a dicom image properly on PIL(Python Image Library) I have used the code in the following link [URL="http://code.google.com/p/pydicom/wiki/ViewingImages"]http://code.google.com/p/pydicom/wiki/ViewingImages[/URL] but it shows some blur thing and not shows the correct image when i open the same image in dicombrowser it displays clear image but …

Member Avatar for python_user
0
2K
Member Avatar for ihatehippies

How do you keep a wx frame from not responding while the code is running in the background? ie a search or other demanding function.

Member Avatar for ihatehippies
0
906
Member Avatar for nutrion

All, First, thanks for reading! I'm very new to python, and I'm trying to do something that seemingly feels impossible. I'm using Python 3.x to write a script. This script, so far, only runs Windows "net use" command and gets back drive mapping info. The problem is that I need …

Member Avatar for ckoy
0
288
Member Avatar for MUFC4life

Hi i was just wondering if anybody could help me with this code. #! /usr/bin/env python # -*- coding: UTF-8 -*- [CODE]import turtle def initialize ( color = "blue" , smallest = 1.0 ) : turtle.clear ( ) turtle.up ( ) turtle.goto ( -100.0 , 100.0 ) turtle.setheading ( 0 …

Member Avatar for TrustyTony
0
290
Member Avatar for kiddo39

I'm having trouble getting my python scripts to insert into a mysql database. I'm able to do other commands successfully such as adding or dropping tables, selecting items from tables but inserting into tables isn't working. I can manually insert but the script won't do it. I have an entry …

Member Avatar for richieking
0
127
Member Avatar for justaguy101

This is not necessarily a Python or wxPython related question. Let's say i have GUI made with wxPython. How does one implement changing language of the GUI(menu names, help strings etc.) in a correct way. Thanks.

Member Avatar for richieking
0
259
Member Avatar for Thisisnotanid

Hi everyone, I'm new to Daniweb and programming in general. I wrote a program to implement Euler's sieve, and it seems to work for small primes. But, it incorrectly lists certain numbers as primes for larger ranges. For example, for n = 400, it lists 391 as prime. I've gone …

Member Avatar for Thisisnotanid
0
138
Member Avatar for Tcll

KK so I have 2 py files... 1 being the main, and the other, the plugin I have a list var in the main, that I'd like to append data to from the plugin how do I do it?? the data to append: (from plugin) ' ('template', '*.tmp') ' the …

Member Avatar for Tcll
0
604
Member Avatar for Mouche

Zonr and I have been working on a fun text game containing different rooms, monsters (with a D&D-esque battle system), and save/load functions. Here are the files. You need to have all of them for it to work correctly: [URL="http://www.glenwinters.com/RPG/RPG_jan20.py"]www.glenwinters.com/RPG/RPG_jan20.py[/URL] [URL="http://www.glenwinters.com/RPG/data.txt"]www.glenwinters.com/RPG/data.txt[/URL] [URL="http://www.glenwinters.com/RPG/Glen.txt"]www.glenwinters.com/RPG/Glen.txt[/URL] [URL="http://www.glenwinters.com/RPG/George.txt"]www.glenwinters.com/RPG/George.txt[/URL] Here's the main code: [code] import random …

Member Avatar for richieking
0
508
Member Avatar for ChaosKnight11

Hi, I normally only use Linux (Ubuntu) for software development, but I want to test an app on Windows with IE before I make it live. I have Windows 7 Ultimate installed, as well as Python 2.7 and Django 1.2.3 I appended C:\Python27\Scripts to my PATH, and .py to PATHEXT. …

Member Avatar for richieking
0
163
Member Avatar for newbieha

Hello,everyone.Im doing the same project as Slash12 source:[url]http://www.daniweb.com/forums/thread331507.html[/url] I thought the data structure I constructed is correct but I don't know how to test it until my search function works. The errors i have now are: TypeError:__init__() takes exactly 3 arguements(1 given) for i in range(len(board)) has no len() TypeError:object …

Member Avatar for richieking
0
250
Member Avatar for bomko

Hello there. I'm new in python thats why i hope for one quick explanation. I'm making this program just for fun tho i dunno how to really use raw_input in loop. [CODE]from random import * ime_f = raw_input("Vnesi ime fanta: "); priimek_f = raw_input("Vnesi priimek fanta: "); ime_z = raw_input("Vnesi …

Member Avatar for seanbp
0
125
Member Avatar for tammy12w

ok so every time i write this f=open('file.html') p=f.read() this come out and i do not understand it help!! p=f.read() File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 8171: ordinal not in range(128) i am trying to open a .html …

Member Avatar for richieking
0
8K
Member Avatar for ultimatebuster

This app will execute and exit right after the process is complete. It will log different things using the logging module. For some reason everytime, no matter if the app execution is a success or a failure, it will tell me an error has occred, and see the log file …

Member Avatar for ultimatebuster
0
101
Member Avatar for FAITH2011

Hi all, I was wondering if someone could help me with this bit of coding. I have set two veriables d1 and d2 to pick a random int of 1 to 10: which I need for in loop but when I run it the same number appear How do I …

Member Avatar for FAITH2011
0
149
Member Avatar for pi_lord12

Hey, I'm new to Python and wondering about the following bit of code. It tells me that the module random has no attribute randint. I've looked at the documentation and such and I think I'm doing it correctly, but obviously something's wrong. Any ideas? Thanks! [code] import random int1=random.randint(1, 6) …

Member Avatar for pi_lord12
0
2K
Member Avatar for jjma

Hi. I'm trying to make a function that takes nested tuples and returns a list of each nested tuple. I managed to make a function that returns the values of the tuples (which are strings), but cannot figure out how to retrieve the 'subtuples' in a list. Here's what I …

Member Avatar for jjma
0
807
Member Avatar for LanierWexford

I have Python 2.7 installed, and I need to use matplotlib, but it is only available for Python 2.6. Is there any way to have 2.6 and 2.7 installed at the same time or is this asking for trouble? The reason I need matplotlib is I am trying to run …

Member Avatar for richieking
0
169

The End.