15,190 Topics

Member Avatar for
Member Avatar for ErlendHL
Member Avatar for vsagarmb

<code=python> >>>f = file("sendBuffer.dat","rb") >>> f.read() '\x81x\x00>\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A .\x00\x10aG\xce\x00 \x00\x00\x00\x00\x00\x00\x00\x01\xcd\xccL@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x 00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' >>> text = f.read() >>> print text </code> In the above code f.read() prints the data, but when i say print text or print length of text it returns NULL and zero respectively. Any Ideas?

Member Avatar for vsagarmb
0
86
Member Avatar for valorien

Hi Everyone :cool: What is the best way to represent, modify, and perform calculations with hexadecimal values (for instance, byte addresses) in Python? It seems every time I play with hex numbers, I'm always getting the result as a string or regular int type. case in point: Let's say I …

Member Avatar for Gribouillis
0
14K
Member Avatar for hadoque

Hi i'm totally new to python and I'm trying to make an easy GUI with tkinter that should take a name of a textfile in an entry widget, and when you click a button the text in the entry should be passed to a function handling the file. This is …

Member Avatar for hadoque
0
469
Member Avatar for ennoil

I have a csv file with 4 columns that I want to use to create menus. For example, the second column has values such as "TEST", "QA", "PROD" and a couple of others. I want to take all the values from the second column, weed out the duplicates, then create …

Member Avatar for sergb
0
2K
Member Avatar for pietromarchy

Hi guys, a not so complex question: [CODE] form xml.etree.ElementTree import * >>> tostring("<home><room>bedroom</room></home>") '<home><room>bedroom</room></home>' [/CODE] I would like to have the indentation in for the string. Something like: <home> [INDENT]<room>bedroom</room> [/INDENT] </home> Of course my document is a little complex. Is it possible to have it in an automatic …

Member Avatar for pietromarchy
0
669
Member Avatar for vello

[CODE]# -*- coding: utf-8 -*- p = [1, 2, 0, -1, 3, 4, 5] smaller = 0 bigger = 0 i = 0 while i < len(p): if p[i] >= p: bigger += 1 print bigger i += 1[/CODE] #bigger than -1 is (1, 2, 0, 3, 4, 5) #bigger …

Member Avatar for TrustyTony
-1
158
Member Avatar for bjoernh

Hi there. Day 2 of programming python. In this thread I posted my first attempt [url]http://www.daniweb.com/forums/post1231604.html#post1231604[/url] and growing from there it goes to slightly deeper water here. I have three .txt files: nvutf8.txt here new vocab items are stored esutf8.txt here example sentences are stored exoututf8.txt example sentences from esutf8.txt …

Member Avatar for bjoernh
0
171
Member Avatar for zalogarcia

i need to make a program that adds numbers, but asking first the user how many numbers he wants to add, and then adding them. any one knows how to do that

Member Avatar for snippsat
0
102
Member Avatar for ultimatebuster

I just used MonoDevelop 2.2 for Python under Ubuntu. IT'S AMAZING! Code hinting seems to not be working though... Anyone has any idea on when the python is gonna jump to windows?

Member Avatar for jcao219
0
195
Member Avatar for kedarm

Hi! I'm trying to use the opencv bindings of Python. I tried the following code: [CODE]from opencv.highgui import * from opencv.cv import * cam = 'cam' cvNamedWindow(cam) cap = cvCreateCameraCapture(0) while cvWaitKey(1) != 27: img=cvQueryFrame(cap) cvShowImage(cam,img)[/CODE] Although the window seems to open fine, I cannot see any image. I just …

Member Avatar for Ratzian
0
317
Member Avatar for oaktrees

I have code that opens a URL, whose page looks like this... "A",31.49,"5/26/2010","4:00pm",+0.25,31.51,32.25,31.37,3811721 The code parses this web page and writes it to a CSV file. Here is a snipet of the code, [CODE] def __req(stat): url = ... % (stat) return urllib.urlopen(url).read().strip().strip('"') #Manipulate data from web and write to …

Member Avatar for oaktrees
0
85
Member Avatar for cableguy31

I'm writing a script to scan Windows shares. Running the script from Windows, it works fine. But running it from Linux and it doesn't work. I don't get any errors, it just doesn't return anything. I'm guessing this is probably an authentication issue of some kind. On Windows, it automatically …

Member Avatar for Gribouillis
0
185
Member Avatar for vlady

Hello, I learn tuples and I came acros the folloving explanation which I don't understand practicly because the scipt is not complet..., I think tha they want to show the direction but for me would be better complet example... so it's from document: Think Python (version 1.1.19) and text is …

Member Avatar for vlady
0
146
Member Avatar for shonabagylas

hi is it true that reverse engineering a compiled python "program" is significantly easier than other languages ? thank you

0
20
Member Avatar for dbphydb

Hi, I have a code which uses HTMLParser to reach a webpage where an exe file is located. The code then downloads and installs the file on local machine. I need a solution for the below problem: HTMLParser reaches a webpage where there are links to clients_test2, clients_test5, clients_test8. Each …

Member Avatar for dbphydb
0
161
Member Avatar for nramya82

Hi all, I am very new to programming , I am trying to do task where I have to count the number of lines that are read until the total length of the lines is 1,000 characters and also it it doesn't count characters on any line that begins with …

Member Avatar for TrustyTony
0
111
Member Avatar for bharatvamsi

hi, i'm novice user in python and i want to capture data at a specific port using python script.Please suggest me the approach. Same data i'm able to write into a file using linux command: tethereal -i any "port 9060" -w sam.txt I want to accomplish the above task using …

Member Avatar for Azeriah
0
293
Member Avatar for oaktrees

Could someone point me in the right direction? I have two excel files that I would like to merge. Is xlwrt and xlrd the place to start? If so, are these part of the standard library? Thank you.

Member Avatar for jcao219
0
121
Member Avatar for funfullson

I found that in python we have no realy private attributes.we just can use _ or __.but these are not deny access to my attributes.some thing such as private variables in c++. Is it TRUE? Realy python is week in these?

Member Avatar for jcao219
0
259
Member Avatar for pythonnewbie10

[code=php]'''process a file of students''' def main(): f = open( "Ex9_2010_input.txt", "r") line = f.readline() while len(line) != 0: print line line = f.readline() main() [/code] In this case, the file contains comma separated values, each line representing student names and assessment marks in this format: FirstName, LastName, Asg1Mark, Asg2Mark, …

Member Avatar for TrustyTony
0
111
Member Avatar for bjoernh

Hi there, I started Python today. My first mini-project is supposed to find strings in a text-file. Here is what I have written: [CODE] infile = open("Python/es.txt","r") text = infile.read() infile.close() print text search = 'du' index = text.find(search) if index==-1: print "nothing found" else: search, "found at index", index …

Member Avatar for griswolf
0
541
Member Avatar for lewashby

I'M using Ubuntu and I'M running python 3. I'M trying to find a pygame download for Ubuntu and python 3. I went to pygame.org and followed the Ubuntu link. I eventually found one link for pygame 1.9, which I'M told works for pythan 3. There were two files, amd64 & …

Member Avatar for griswolf
0
348
Member Avatar for atsuko

Hi there, I am new to python. Can somebody tell me how can I count a given word from a file. I found lots of solution for counting all the words in a file, but not for some particular ones. Thanks in advance

Member Avatar for TrustyTony
0
705
Member Avatar for Roiti

Hello I am kind of a new programmer in python and I tryed to do a port scanner. I have a problem here but I can gigure it out' when I try to compile it it just gets stuck :S Here is the code [CODE] import socket as sk import …

Member Avatar for The_Kernel
0
244
Member Avatar for ITgirl2010

I need to create an application that utilizes your Order class to implement a simple Order tracking system. To do this your system must be able to deal with a number of orders. Your application should have the following capabilities: 1. Create a new order 2. Update an existing order. …

Member Avatar for sneekula
0
99
Member Avatar for linuxoidoz

Hi, How can I convert a 64-bit unicode string into a text string? I'm converting ASCII characters for example like this [CODE]str = unichr(int('00A9', 16))[/CODE] But how can I convert unicode 'U2082' or any other character beyong the ASCII range? Thank you.

Member Avatar for Gribouillis
0
197
Member Avatar for pythonnewbie10

The Question below has been given to me: An internet shop requires an order tracking system. When someone buys an item online, an Order is created. However, orders are not sourced and processed until payment has been confirmed. Once the order has been processed it can be shipped. The order …

Member Avatar for snippsat
0
295
Member Avatar for ITgirl2010

I have been given this program that maintains a catalog of items '''maintain a catalog''' [code=php]def main(): global catalog loadCatalog() while True: pick = showMenu() if pick == 0: break elif pick == 1: sellItem() elif pick == 2: buyItem() else: print "Invalid selection" saveCatalog() def showMenu(): global catalog while …

0
65
Member Avatar for py.thon

Hello ,Iam trying to write a programme for the connect -N game : Your program must allow two people to play Connect-N against each other using a text-based interface. Since this is a text-based game, we do not represent the players as colours(traditionally red and yellow), but instead as numbers: …

Member Avatar for ANTALIFE
0
820

The End.