15,185 Topics

Member Avatar for
Member Avatar for nouth

It is possible to read/write the binary of any file with using Python? `open(file, "b")` only works for windows `"rb"` `"rb+"` `"wb"` `"wb+"` `"ab"` `"ab+"` works but `.read()` just prints the file contents not its binary

Member Avatar for nouth
0
711
Member Avatar for rogerg

Hello, I have a mac os specific problem with iPython. The code I have works fine by using iPython on a PC by launching it with --pylab. On mac os, I try to do it with ipython-qtconsole-1.0.0-py27_0 My code is made for recognizing characters on an image. The part of …

Member Avatar for rogerg
0
293
Member Avatar for heycooldude

I have my outlook mailboxes in this structure mailbox1 -Inbox Mailbox2 -Inbox Current script is able to access Inbox of mailbox1 as it is my main mail box where as mailbox2 has been added into my profile. I want to be able to access Inbox of Mailbox2 import win32com.client import …

0
180
Member Avatar for varshaholla

hello, i want to know whether i can display an image from the path i have selected? like, i have a path for example: c:\user\desktop\33.jpg, and i want to take only that jpg file and i have to display that image using label or something. If it is possible, i …

Member Avatar for varshaholla
0
332
Member Avatar for Diego_4

position = 0 tasks = [] task = [task1,year,month,day, hour, minute, second, microsecond,str(cuando),cuando]# this is a list that is filed into another list# while k < CantTareas : ans = raw_input ("did you finish any of your tasks? (yes or no) ") if ans == "yes": k = k + …

Member Avatar for snippsat
0
228
Member Avatar for veledrom

Hi, I'm about to start learning Python and want to find an IDE. For example something Visual Studio like stuff. WYSIWYG so when I write code, I should have a button somewhere to click and see the output. For free and for Windows and Linux platforms. I downloaded Komodo Edit …

Member Avatar for Tcll
0
510
Member Avatar for jtran57

I am trying to make the shape move here is my coding bif="space.jpg" import pygame, sys from pygame.locals import * points=[(-60,20),(-60,-20),(-20,60),(20,60),(60,20),(60,-20),(20,-60),(-20,60)] colour=(0,191,255) pygame.init() screen=pygame.display.set_mode((1280,800),0,32) background=pygame.image.load(bif).convert() x,y=0,0 movex,movey=0,0 while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() if event.type==KEYDOWN: if event.key==K_LEFT: movex=-1 elif event.key==K_RIGHT: movex=+1 elif event.key==K_UP: movey=-1 …

0
46
Member Avatar for kxjakkk

file_spellcheck = input("Name of the document to be spell-checked: ") with open(file_spellcheck, "r") as i: spellchecking = i.read() for item in spellchecking: items = item.split() if items in with open("file.out", "w") as i: i.write() I need to make a spell checker that uses another file as a dictionary. So let's …

Member Avatar for vegaseat
0
273
Member Avatar for rbyrd

I'm trying to write a program in which a message box is to appear on the application window when the application is launched. The code below produces the message box, but it appears as a separate window that is not over the application window. Is there a way to fix …

Member Avatar for woooee
0
311
Member Avatar for kxjakkk

#Import Story text = open('./alice.txt', 'rb').read() #Split the text into individual words def split_text(text): #Import known words index index = open('./words.dat', 'rb').read().split() index_file = open('./words.dat','wb+') for word in index: index_file.write(word) index_file.write('\n') import string #Remove punctuation out = "".join(c for c in text if c not in string.punctuation).lower() # split the …

Member Avatar for snippsat
0
2K
Member Avatar for asadmoosvi

I have been programming for quite a while in Python but have just started to learn OOP properly. I find it really confusing and I don't really understand it. Especially the implicit self that python automatically passes. It just isn't clicking, really. May someone provide an easy explanation of what …

Member Avatar for vegaseat
0
324
Member Avatar for tutsie12
Member Avatar for tony75

Hi I got this error ImportError: No module named Crypto.Cipher Where can I find the module for windows and debian linux? How can I fix error both in windows and Linux? importerror no module named crypto.cipher windows Traceback (most recent call last): File "C:\Users\Win/\Desktop\client.py", line 2, in <module> from Crypto.Cipher …

Member Avatar for tony75
0
16K
Member Avatar for kxjakkk

I'm trying to create a program that will prompt the user for a list of text files to read from, then read those text files and build a dictionary of all the unique words found. Then finally put those unique words into another file and make it alphabetical order from …

Member Avatar for kxjakkk
0
640
Member Avatar for knan

I have a dictionary [CODE]dict1={'18':['4000','1234'],'12':['7000','4821','187','1860','123','9000']}[/CODE] I want to sort the keys and values such that, the output is, [CODE]dict1={'12':['123','187','1860','4821','7000','9000'],'18':['1234','4000']}[/CODE] I tried something! but it didn work [CODE]>>> for values in dict1: ... dict1[values].sort() ... >>> dict1 {'18': ['1234', '4000'], '12': ['123', '1860', '187', '4821', '7000', '9000']}[/CODE] Full sorting happens for …

Member Avatar for grantjenks
0
807
Member Avatar for PC

My code has a raw_input in it - when I press Enter, it completely ruins the code which says that the string index is out of range. The annoying thing is that if you don't press Enter and type something in, it works perfectly fine. So my question is - …

Member Avatar for Gribouillis
0
182
Member Avatar for alagez

Hi there, I am planning to create one robot choosing center. But I do not know how to use the idea to execute in python software. my idea is, let say a customer wants to choose a robot how to use the rule below to execute in python: IF the …

Member Avatar for alagez
0
276
Member Avatar for abaddon2031

I have a python code that reads several csv files and writes teh data to a single file but every time it loops back around to the next file it prints the headers again. Is there a way to stop this I can post my code if it is nessisary.

Member Avatar for abaddon2031
0
293
Member Avatar for Spencer_3

Hello I'm currently working on a Interface for fun as a side project using Tkinter. I was wondering if anyone had a small code for a password and shutdown button I do have the button however it doesnt shut down the program. the password has a text box and is …

Member Avatar for Spencer_3
0
1K
Member Avatar for Nafisa Morsalin
Member Avatar for reham.mostafa.14268

I have two text files and I want to compare them and save the matched columns to a new text file. file1: 114.74721 114.85107 114.85107 2.96667 306.61756 file2: 115.06603 0.00294 5.90000 114.74721 0.00674 5.40000 114.85107 0.00453 6.20000 111.17744 0.00421 5.50000 192.77787 0.03080 3.20000 189.70226 0.01120 5.00000 0.46762 0.00883 3.70000 2.21539 …

Member Avatar for vegaseat
0
489
Member Avatar for aditya369

Hello all, please help me in writing a tic-tac-toe python program which actually learns as it plays with the user. So, starting as a dumb opponent, the program should be able to learn from the games being played against the user and evolve as a clever opponent it plays along... …

0
165
Member Avatar for begueradj

Hello How can we know which GCC version is compatiable with a given Python version ? Regards

-1
125
Member Avatar for John A.

Hey guys, this is my first project since I completed [CodeAcademy's](http://www.codeacademy.com) Python course yesterday. Besides that course, this is my first time programming and I would really appreciate input on my program. I decided to create a database to help me keep track of the anime I watch. For this …

Member Avatar for Gribouillis
0
398
Member Avatar for crebs

I have this code that works well. It works in a way that I have to type a function such as soccer for the games.soccer module to be active then i can type a query such as 'latest scores', again after i close this then type autocare for this to …

Member Avatar for John A.
0
160
Member Avatar for trade19

python3 Hi I am trying to compare these two (strings) of numbers. There may not be a space inbetween the numbers in the file, but here its just for clearity. I want to take the value of 40 and compare it with 14 then 18,35 and so on until 54 …

Member Avatar for trade19
0
408
Member Avatar for heycooldude

Hi, I want to send back reply to the same email but with different email account. Here is my script mail = outlook.Session.GetItemFromID(ID) subject = mail.Subject if mail: message_reply = mail.Reply() message_reply.From='_from_email' #not working message_reply.Body = "THE FOLLOWING TASK HAS BEEN MARKED AS COMPLETED: \n\n" message_reply.CC= '_CC_Email' message_reply.Send() I tried …

0
155
Member Avatar for GKAB

Hi All Dears, I hope this finds you well! Im a new Python learner. My aim is to use a script that will fetch any web site news. I came across URLLIB & URLLIB2 Anyone to kindly provide a guide on how to do this? In advance thanx alot!

0
74
Member Avatar for navi2582

I am trying to toggle between the two toolbars (in two different panes) and couldn't do it with the code below. Not sure where the problem is.... I should only see "Page number" details when I click on "Read/Write" and "Hello world" when I click on "Write". Any ideas are …

0
185
Member Avatar for kxjakkk

My Rational class code: from __future__ import division import math as _math def _gcf(a, b): # Returns the greatest common factor of a and b. a = abs(a) b = abs(b) while b: a, b = b, a % b return a class Rational(object): def __init__(self, numerator=0, denominator=1): # Contructs …

Member Avatar for Schol-R-LEA
0
300

The End.