15,175 Topics
| |
| This is a program intended to write text to any file specified var_file = (raw_input('nof$ ') #nof, number of files. try: text = str(raw_input('ttwtf$ ') #ttwtf, text to write to files. print text >>> var_file except ValueError: print "Error: Not a string" main() When the program starts the "`try`" part … |
0 down vote favorite I have written a code to convert decimal numbers into hexadecimal equivalent. The program prints correct value till '2559'. How to get correct values of hexadecimal for larger numbers. Here is my code: ######################################### # Decimal to Hexadecimal Conversion # ######################################### def DectoHex(n): if n <= … | |
I'd like to make a dictionary subclass that takes in positional keywords in addition to the standard *args, **kwargs. I found this example on stackoverflow: class attrdict(dict): def __init__(self, *args, **kwargs): dict.__init__(self, *args, **kwargs) self.__dict__ = self a = attrdict(x=1, y=2) print a.x, a.y print a['x'] b.x, b.y = 1, … | |
Hi, I think I have a pretty simple question but my google searches are giving me more information than I need. I think my terminology is not clear. Let's say I'm making a dictionary to hold a datatype very specific to some filetype or data of interest. Let's say I … | |
I am a fledgling at best when it comes to programing. I am trying to acclimate myself with Python's date and time functions. Below is a program I wrote to calculate the Sun rise and set times for a given lat, long. What I am hoping to find out is … | |
I am trying to learn how to install packages into python. Asn example is http://www.clearskyinstitute.com/xephem/. I have no idea how to do this. I have viewed a variety of sites to help, but none really explain how someone with no clue can do this. Any leads welcome. Thanks | |
Hi, I have been subclassing namedtuple to handle my custom data type: fields=['Query', 'u1', 'Accession] Old = namedtuple('Old', fields, verbose=False) class New(Old): def __repr__(self): return 'Overwriting works nicely' p=New('Hi',2,3) print p >>> 'Overwriting works nicely' What I want to do is to add the behavior that some of my fields … | |
Hi guys, This is more a general discussion of methodology than a specific question. I have been working on a, the primary purpose of which is to store an oddly formatted data file (aka not you classic CSV). At the end of the day, the data is stored in a … | |
As the title says, I have a flash drive, and a script on that flash drive. Whenever I plug my drive into my Mac OSX, I want a specific Python script that is on my drive to run, and be able to access directories on my computer. Why am I … | |
My script is sapposed to have you choose a number and then spit out that number of 1's and 2's randomly chosen and then count and post how much.could someone help me by telling me what is wrong, i would really apreciate it, here is the script(it is a cmd … | |
I am learning about networking and programming. I am trying to be a simple IM application. What i am trying to achieve having a server application route messages between computers over the internet creating a simple instant messenger. However i can't find any sort of tutorial for that. I want … | |
I am trying to call functions from a DLL `function oziRepositionWP(Number:integer;lat,lon:double):integer;stdcall; ` I have written the code in python no = c_int(1) lat = c_double(34.00962) lon = c_double(74.80067) var =windll.OziAPI.oziRepositionWP(byref(no),byref(lat),byref(lon)) But i get the message var =windll.OziAPI.oziRepositionWP(byref(no),byref(lat),byref(lon)) ValueError: Procedure probably called with not enough arguments (8 bytes missing) where am … | |
Hi again, I'm here to ask another stupid question so I apologize. I'm going to make a calculator in Python but I've ran into a wall, with the tutorials I've been following I've only ever been taught how to add two numbers together. Never have I learned how to add … | |
Hello python world. I am new to python. I need some help in creating a table. It is an input file as <name>,<age>,<gender>,<marks>. these items can be seperated using a ','. The test part would contain mixed spaces.. e.g Jhones can be written as __JHoneS__. but if has to return … | |
Hi, I have made a square that will move but there are some bugs in the movement. I can't find anything wrong with the logic which is why I need help ;) You have to press left and right to move the square. The problems with the movement are: 1: … | |
How do you make Python accept multiple strings and break them down in an input? For example, main = input ('> ') if main == ('ECHO',some_words): print (some_words) But everytime I do that, the some_words string wouldn't be defined. Error Message: Traceback (most recent call last): File "<pyshell#7>", line 1, … | |
Hi, I just installed PyQt Designer to start creating UI's with python, I've used WxPython and TKinter before, but never really done anything with PyQt. So for some of you this might be a very simple question that I can't seem to find with google. I really like how it … | |
I need to write a code that imports a list of files then goes through each file and rewrites only half the file. Cutting off the file at a key word. If I can make my code print the half I need I can make it write new files with … | |
Hey all I would like to ask a few questions about an idea I had for my forensics class. 1. How hard would it be to create a script that monitored when icons on the desktop are moved? AND (bonus) if they are in a specific placement THEN call a … | |
Can someone give a code snippet on how to 'chat' using the XMLRPC library in Python? Here's my server code: from xmlrpc.server import SimpleXMLRPCServer from xmlrpc.server import SimpleXMLRPCRequestHandler import os from os import access, path PATH = 'chatlog.$' class RequestHandler(SimpleXMLRPCRequestHandler): rpc_paths = ('/RPC2',) server = SimpleXMLRPCServer(("localhost", 8000), requestHandler=RequestHandler) server.register_introspection_functions() server.register_function(pow) … | |
Is it possible (without using any external modules) to make two computers, or Python programs communicate through an Ethernet cable? E.g. Sending messages, numbers, etc. And if so, how? | |
I would like to develop a SQL injection vulnerbility scanner. However, i dont know how to develop it, It is any module in python could help me develop this app? My app requirement User able to input the target URL and apply SQL injection scanning on target URL After that, … | |
Could someone please give me a pointer as to why my use of appendText fails? This is my first bit of programming for 30 years - I'm sorry if its an idiot mistake :) The program has 2 text fields. You paste a list of url's into the first box … | |
How do you make Python set an str from a file? For example, my file would contain these pieces of text: username=Eugene password=eugene How do I get Python to return this? >>> print(username) Eugene >>> print(password) eugene Any help is deeply appreciated. Thanks! | |
Hey guys, I had a quick question. Let me try to explain what I'm trying to do here. I'm a bit new to numpy and I'm writing a parallelized code. It is working fine without the use of NumPy, but I'm trying to learn by getting it to work both … | |
Im brand new at python and am trying to teach myself through a book. Im trying to run a very simple command but I keep on getting a syntax error. If someone could take a look at it and tell me what im doing wrong I would greatly appreciate it. … | |
I have been trying to create a text file and code it in UTF-8. I have managed to do it using codecs However, I am having trouble when I ask the user for input. Any ideas? # -*- coding: cp1252 -*- import codecs fileName = "testing1" textFile = codecs.open(fileName, "wt", … | |
Hello im new in python and have a small project to do . my project is cms detector in python at first its in consol and does not has gui . because of im a newbie in programing i dont know how to begin the project . is there any … | |
Hey, Do any one know how to get only Lang ID from Google chrome site ("view-source:https://www.google.com/chrome?hl=en-GB") using this regex "<option value=""([a-zA-Z]*)"">[�-9; a-zA-Z()]*</option>" ? |
The End.