15,185 Topics
| |
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 | |
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 … | |
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 … | |
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 … | |
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 + … | |
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 … | |
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 … | |
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 … | |
| 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 … |
#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 … | |
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 … | |
how do I run a python class without creating an object | |
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 … | |
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 … | |
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 … | |
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 - … | |
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 … | |
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. | |
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 … | |
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 … | |
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... … | |
| Hello How can we know which GCC version is compatiable with a given Python version ? Regards |
| 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 … |
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 … | |
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 … | |
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 … | |
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! | |
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 … | |
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 … |
The End.