15,175 Topics

Member Avatar for
Member Avatar for HTMLperson5

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 …

Member Avatar for HiHe
1
172
Member Avatar for jwalajoseph
Member Avatar for peterparker

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 <= …

Member Avatar for peterparker
0
1K
Member Avatar for hughesadam_87

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, …

Member Avatar for hughesadam_87
0
714
Member Avatar for hughesadam_87

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 …

Member Avatar for hughesadam_87
0
438
Member Avatar for manticmadman

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 …

Member Avatar for hughesadam_87
0
360
Member Avatar for manticmadman

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

Member Avatar for TrustyTony
0
53
Member Avatar for hughesadam_87

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 …

Member Avatar for hughesadam_87
-1
147
Member Avatar for hughesadam_87

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 …

Member Avatar for hughesadam_87
0
156
Member Avatar for Plazmotech

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 …

Member Avatar for Plazmotech
0
239
Member Avatar for bendoveryou

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 …

Member Avatar for TrustyTony
0
116
Member Avatar for nahsik

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 …

Member Avatar for extr3mex
1
321
Member Avatar for nishant.rathee

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 …

Member Avatar for HiHe
0
577
Member Avatar for Frensi

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 …

Member Avatar for HiHe
0
6K
Member Avatar for depy

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 …

Member Avatar for ZZucker
0
119
Member Avatar for ThePythonNoob

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: …

Member Avatar for ThePythonNoob
0
3K
Member Avatar for 3e0jUn

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, …

Member Avatar for TrustyTony
0
185
Member Avatar for Dan08

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 …

0
137
Member Avatar for dwhite12

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 …

Member Avatar for dwhite12
0
231
Member Avatar for PlasmoMage

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 …

Member Avatar for imamyth
0
101
Member Avatar for 3e0jUn

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) …

Member Avatar for Gribouillis
0
485
Member Avatar for 3e0jUn

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?

Member Avatar for 3e0jUn
0
156
Member Avatar for BARATUM

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, …

Member Avatar for ryantroop
0
910
Member Avatar for p34i

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 …

Member Avatar for p34i
0
127
Member Avatar for 3e0jUn

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!

Member Avatar for 3e0jUn
0
243
Member Avatar for fatalaccidents

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 …

Member Avatar for fatalaccidents
0
362
Member Avatar for napierin

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. …

Member Avatar for napierin
0
233
Member Avatar for duckduck

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", …

Member Avatar for TrustyTony
0
137
Member Avatar for Arash-Sh

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 …

Member Avatar for Arash-Sh
0
753
Member Avatar for heheja

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]*)"">[&#0-9; a-zA-Z()]*</option>" ?

Member Avatar for heheja
0
161

The End.